aarondfrancis / vue-model

Model component for Vue.js
MIT License
855 stars 42 forks source link

#16 Added unit tests #21

Closed LarryBattle closed 7 years ago

LarryBattle commented 7 years ago

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

Related PRs

sne11ius commented 7 years ago

Merge plz :D

aarondfrancis commented 7 years ago

Merged! Thanks a million @LarryBattle.