Skip to content

Commit f29d338

Browse files
committed
test(v-text/v-html): Add tests to check toString and toJson methods.
1 parent 5e3823a commit f29d338

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

test/unit/features/directives/html.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ describe('Directive v-html', () => {
4444
vm.a = {}
4545
}).then(() => {
4646
expect(vm.$el.innerHTML).toBe('{}')
47+
vm.a = { toString () { return 'foo' } }
48+
}).then(() => {
49+
expect(vm.$el.innerHTML).toBe('foo')
50+
vm.a = { toJSON () { return { foo: 'bar' } } }
51+
}).then(() => {
52+
expect(vm.$el.innerHTML).toBe('{\n "foo": "bar"\n}')
4753
vm.a = 123
4854
}).then(() => {
4955
expect(vm.$el.innerHTML).toBe('123')

test/unit/features/directives/text.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ describe('Directive v-text', () => {
3030
vm.a = {}
3131
}).then(() => {
3232
expect(vm.$el.innerHTML).toBe('{}')
33+
vm.a = { toString () { return 'foo' } }
34+
}).then(() => {
35+
expect(vm.$el.innerHTML).toBe('foo')
36+
vm.a = { toJSON () { return { foo: 'bar' } } }
37+
}).then(() => {
38+
expect(vm.$el.innerHTML).toBe('{\n "foo": "bar"\n}')
3339
vm.a = 123
3440
}).then(() => {
3541
expect(vm.$el.innerHTML).toBe('123')

0 commit comments

Comments
 (0)