Learn Vue JS course Learn Javascript and Vue JS Learn VueJS course Learn VueJS Tutorial

Testing Vue.js Components

Get access to this course, 15 others, and future Vue.js courses!

Start Learning

Already got an account? Log in

Learn How To Test Computed Properties and Watchers

In this lesson, we’ll learn how to test one of our favorite features of Vue.js, computed properties, and watchers.

There is also a testing exercise at the end of the lesson.

Exercise:

Create a test that given a string ending with f, as a temp prop.

Expect that the fahrenheit computed property must be a number equal to the prop without the f suffix.

The celsius computed property should convert the Fahrenheit to Celsius.

Example:

Given temp: ’50f’ , vm.farenheight should be 50 and vm.celcius should be 10.

Click here to view the solution.