child_spec.js 519 B

1234567891011121314151617181920212223242526
  1. var Vue = require('../../../../src/vue')
  2. describe('Child API', function () {
  3. var vm
  4. beforeEach(function () {
  5. vm = new Vue({
  6. data: {
  7. a: 1,
  8. b: 1
  9. },
  10. directives: {
  11. test: function () {}
  12. }
  13. })
  14. })
  15. it('default', function () {
  16. var child = vm.$addChild()
  17. expect(child instanceof Vue).toBe(true)
  18. expect(child.a).toBeUndefined()
  19. expect(child.$parent).toBe(vm)
  20. expect(child.$root).toBe(vm)
  21. expect(vm.$children.indexOf(child)).toBe(0)
  22. })
  23. })