Evan You
9 years ago
2 changed files with 44 additions and 7 deletions
@ -0,0 +1,30 @@ |
|||
import Vue from 'vue' |
|||
|
|||
describe('Options propsData', () => { |
|||
it('should work', done => { |
|||
const A = Vue.extend({ |
|||
props: ['a'], |
|||
template: '<div>{{ a }}</div>' |
|||
}) |
|||
const vm = new A({ |
|||
propsData: { |
|||
a: 123 |
|||
} |
|||
}).$mount() |
|||
expect(vm.a).toBe(123) |
|||
expect(vm.$el.textContent).toBe('123') |
|||
vm.a = 234 |
|||
waitForUpdate(() => { |
|||
expect(vm.$el.textContent).toBe('234') |
|||
}).then(done) |
|||
}) |
|||
|
|||
it('warn non instantiation usage', () => { |
|||
Vue.extend({ |
|||
propsData: { |
|||
a: 123 |
|||
} |
|||
}) |
|||
expect('option "propsData" can only be used during instance creation').toHaveBeenWarned() |
|||
}) |
|||
}) |
Loading…
Reference in new issue