-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learning Vue.js 2
By :

First, let's check on some particularities of unit testing our Vue application and its components. In order to be able to write tests for the component instance, first of all, it should be instantiated! Quite logical, right? The thing is, how do we instantiate the Vue component so that its methods become accessible and easily testable? To test basic assertions of the initial state of the component, you must just import them and assert their properties. If you want to test dynamic properties—things that change once the component is bound to DOM—you must do just the following three things:
Vue
function.When the instance is bound to the physical DOM, once instantiated, the compilation is started immediately. In our case, we are not binding the instance to any real physical DOM element, and thus we have to explicitly make it compile it by invoking manually the mount method ($mount
).
Now you can use...