Bind the VueModel instance to Vue.models.register(). Otherwise, the user will get one of these errors when calling Vue.models.register().
Uncaught TypeError: Cannot read property 'register' of undefined
or
TypeError: Cannot set property 'users' of undefined
If you run the tests in the PR without the changes to VueModel.js, you'll get this output.
Terminal
$> npm test
Output:
Vue.models.register() should
✖ register model(s)
✔ register model(s) when Vue.use(VueModel, options) is called
Finished in 0.003 secs / 0.038 secs @ 02:35:35 GMT-0500 (CDT)
SUMMARY:
✔ 1 test completed
✖ 1 test failed
FAILED TESTS:
VueModel
Vue.models.register() should
✖ register model(s)
Chrome 61.0.3163 (Linux 0.0.0)
TypeError: Cannot set property 'users' of undefined
at Object.register (/tmp/ed43830fc058edb9203b0602f1a56f77.browserify:28533:29)
at UserContext.it (/tmp/ed43830fc058edb9203b0602f1a56f77.browserify:28723:24)
Changes
Added unit tests for VueModel.js in VueModel.spec.js.
Bind the VueModel instance to
Vue.models.register()
. Otherwise, the user will get one of these errors when callingVue.models.register()
.or
If you run the tests in the PR without the changes to
VueModel.js
, you'll get this output.Terminal
$> npm test
Output:
Changes
VueModel.js
inVueModel.spec.js
.Related PRs