How it works...

Since we have the reference to the Vue instance itself, we can access methods and status variables directly in our tests.

I would like you to spend some time appreciating the name of the tests. The first is titled should greet in Italian after toItalian is called. It doesn't make any reference to the page or the graphics, and it doesn't make any assumption on preconditions. Note that the button is never clicked on and, as a matter of fact, the button is not mentioned in the test title.

Had we titled the test should display 'Ciao Mondo' when Translate button is clicked on, we would have lied because we never check whether the greeting is actually displayed and we never click on the button in our test.

Naming the test the right ...

Get Vue.js 2 Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.