All language subtitles for 010 Testing Connected Components_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:02,130 --> 00:00:04,250 Now let's continue writing tests 2 00:00:04,250 --> 00:00:08,510 and let's now explore how multiple components can interact 3 00:00:08,510 --> 00:00:10,860 with each other and how we can test that 4 00:00:10,860 --> 00:00:14,420 and how we can work with props and tests. 5 00:00:14,420 --> 00:00:16,040 And for this, I'll stick to this 6 00:00:16,040 --> 00:00:18,790 very simple component I have here. 7 00:00:18,790 --> 00:00:19,910 And what I want to do here 8 00:00:19,910 --> 00:00:22,370 is now I want to create a new component, 9 00:00:22,370 --> 00:00:24,600 the output component 10 00:00:24,600 --> 00:00:25,940 which does what the name implies. 11 00:00:25,940 --> 00:00:28,660 It just outputs something. 12 00:00:28,660 --> 00:00:32,270 So this will be a quite straightforward component. 13 00:00:32,270 --> 00:00:35,880 And of course I'm keeping it deliberately simple 14 00:00:35,880 --> 00:00:38,571 so that we can explore these basic testing concepts 15 00:00:38,571 --> 00:00:41,640 with basic examples. 16 00:00:41,640 --> 00:00:44,210 And the idea of this output component therefore 17 00:00:44,210 --> 00:00:47,030 is just to render a paragraph, 18 00:00:47,030 --> 00:00:50,270 which outputs props.children 19 00:00:50,270 --> 00:00:55,270 or props.text, depending on how you want to do that. 20 00:00:55,430 --> 00:00:58,130 And here I'll say props.children. 21 00:00:58,130 --> 00:01:01,060 And of course, this is kind of a redundant component 22 00:01:01,060 --> 00:01:03,790 but if we could have some extra styles on this paragraph 23 00:01:03,790 --> 00:01:06,490 and then use this as kind of a wrapper component 24 00:01:06,490 --> 00:01:09,330 as we also sometimes did it in this course 25 00:01:09,330 --> 00:01:12,070 for example, with that card component 26 00:01:12,070 --> 00:01:13,840 which we had in some projects, 27 00:01:13,840 --> 00:01:15,053 if you remember that. 28 00:01:16,100 --> 00:01:20,013 So that's the output component and it does use props. 29 00:01:21,120 --> 00:01:23,950 Now here, I got this greeting component 30 00:01:23,950 --> 00:01:26,190 and instead of rendering this paragraph here 31 00:01:26,190 --> 00:01:30,090 I now want to render my output component. 32 00:01:30,090 --> 00:01:32,250 And let's see how that could work. 33 00:01:32,250 --> 00:01:34,360 For this in this greeting component file 34 00:01:34,360 --> 00:01:39,277 I'll import output from dot slash output. 35 00:01:40,210 --> 00:01:44,110 And now we can replace paragraph with output 36 00:01:44,110 --> 00:01:45,750 like this 37 00:01:45,750 --> 00:01:48,083 and like that here. 38 00:01:49,650 --> 00:01:51,660 Now, if I save everything 39 00:01:51,660 --> 00:01:53,540 the nice thing which we'll notice 40 00:01:53,540 --> 00:01:57,690 is that the tests simply continue to work. 41 00:01:57,690 --> 00:02:00,480 So that's the good thing about render 42 00:02:00,480 --> 00:02:02,880 which we use to render the greeting component. 43 00:02:02,880 --> 00:02:06,453 It really renders this entire component tree 44 00:02:06,453 --> 00:02:08,630 that is required here. 45 00:02:08,630 --> 00:02:11,850 So it renders not just greeting 46 00:02:11,850 --> 00:02:15,820 and ignores other components used in that JSX code 47 00:02:15,820 --> 00:02:18,900 but it renders the content of those components 48 00:02:18,900 --> 00:02:22,330 like in this case, the output component as well. 49 00:02:22,330 --> 00:02:26,120 And technically we could therefore call this 50 00:02:26,120 --> 00:02:30,150 an integration test because now more than one unit, 51 00:02:30,150 --> 00:02:32,590 more than one component is involved. 52 00:02:32,590 --> 00:02:36,210 But especially when dealing with such a wrapper component 53 00:02:36,210 --> 00:02:38,520 which doesn't have its own logic, 54 00:02:38,520 --> 00:02:41,130 that's of course not really the right term. 55 00:02:41,130 --> 00:02:44,480 Testing the conjunction of these two components together 56 00:02:44,480 --> 00:02:46,670 is absolutely fine. 57 00:02:46,670 --> 00:02:49,100 And that's why I wanted to show this here. 58 00:02:49,100 --> 00:02:51,210 This is not something that forces you 59 00:02:51,210 --> 00:02:54,090 to split your tests necessarily. 60 00:02:54,090 --> 00:02:56,010 You might want to split them 61 00:02:56,010 --> 00:02:59,470 if the output component becomes more complex 62 00:02:59,470 --> 00:03:01,940 and also starts managing state, 63 00:03:01,940 --> 00:03:04,610 then you might want to test that separately 64 00:03:04,610 --> 00:03:07,310 from the core logic of the greeting component. 65 00:03:07,310 --> 00:03:09,640 But since that is not the case here 66 00:03:09,640 --> 00:03:12,690 we definitely can keep the tests we have here 67 00:03:12,690 --> 00:03:17,113 in greeting test JS to keep testing as we did before. 5194

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.