Write test code for the form

It's TDD time. Let's write more tests into RegisterPage.spec.js. The tests we need to create include the following:

  • Test the initial values of the data model
  • Test the binding between the form input fields and the data model
  • Test the existence of the event handler of the form

Including the previous test, which is used to verify the form's rendering, we will have four tests in this specification. It's time to do some refactoring to the test specification itself. As mentioned earlier, we will also use vue-test-utils, the official unit testing utility library for Vue.js. Let's use the following command to install the library before we start the refactoring:

npm install @vue/test-utils --save-dev

Once that is done, ...

Get Building Applications with Spring 5 and Vue.js 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.