|
|
@ -7,7 +7,7 @@ describe('Directive v-show', () => { |
|
|
|
template: '<div><span v-show="foo">hello</span></div>', |
|
|
|
data: { foo: true } |
|
|
|
}) |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
}) |
|
|
|
|
|
|
|
it('should check show value is falthy', () => { |
|
|
@ -25,31 +25,31 @@ describe('Directive v-show', () => { |
|
|
|
template: '<div><span v-show="foo">hello</span></div>', |
|
|
|
data: { foo: true } |
|
|
|
}) |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
vm.foo = false |
|
|
|
waitForUpdate(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span style="display: none;">hello</span>') |
|
|
|
vm.foo = {} |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
vm.foo = 0 |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span style="display: none;">hello</span>') |
|
|
|
vm.foo = [] |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
vm.foo = null |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span style="display: none;">hello</span>') |
|
|
|
vm.foo = '0' |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
vm.foo = undefined |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span style="display: none;">hello</span>') |
|
|
|
vm.foo = 1 |
|
|
|
}).then(() => { |
|
|
|
expect(vm.$el.innerHTML).toBe('<span>hello</span>') |
|
|
|
expect(vm.$el.innerHTML).toMatch(/<span( style="")?>hello<\/span>/) |
|
|
|
done() |
|
|
|
}).catch(done) |
|
|
|
}) |
|
|
|