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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access