In this chapter, we looked deeper into components by defining the computed properties in our components. Also, we added tests for our components so that we can test the parts of our components individually. With the Vue CLI, we added test files and dependencies easily within our app.
Inside our components, we can emit events that propagate to the parent component with the
this.$emit() method. It took a string with the event name. The other arguments are the payloads that we want to pass from the parent component to the child components.
To add unit tests to our Vue 3 app and run the tests, we used the Jest test framework. Vue 3 adds its own specific APIs to Jest so that we can test Vue 3 components with it. To test components, we mounted the component by using the
shallowMount functions. The
mount function lets us mount the component itself, including the nested component. The
shallowMount function only mounts the component itself without the child components...