This video explains how we can test components that imports image files or any other type of static asset.
- Hey, now we have tests for our components.…We are still not covering all the cases…with the one that we created.…One very common issue that you may face…when testing components is what happens…when that component is rendering a static asset,…in particular images.…So in this video, we are going to see why components…with static assets are difficult to test…and to configure Jest to mock images in our test.…To see why it's difficult…to test component that are rendering images,…we need to actually have a component to render an image…and we currently don't have one like this.…
So let's add an image to our header.…If you remember from our last section,…we already had one image, it's third in our project,…which is the Pakt logo.…So let's add that image to our header,…First, import the image,…and let's render it at the right of the heading.…Let's move the heading inside this div,…and create a little span saying that this course…was brought to you by Pakt publishing.…
Let's make this heading to have an inline block property,…
- Structuring React projects
- Creating and mounting the root component
- Composing components for more complex UI
- Using state to making components dynamic
Skill Level Intermediate
React: Managing Complex Interactionswith Emmanuel Henri1h 45m Intermediate
1. How to Structure React Projects
2. Diving into the First Components
3. Styling Made Easy
5. Painless Components Testing
Configure Jest5m 44s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.