Skip to content

Commit a12a128

Browse files
committed
release: v0.13.2
1 parent b21aad6 commit a12a128

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

jsr.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloydlau/json-editor-vue",
3-
"version": "0.13.1",
3+
"version": "0.13.2",
44
"exports": "./dist/json-editor-vue.mjs",
55
"publish": {
66
"include": [

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "json-editor-vue",
33
"PascalCasedName": "JsonEditorVue",
4-
"version": "0.13.1",
4+
"version": "0.13.2",
55
"private": false,
66
"description": "Vue 2.6/2.7/3 & Nuxt 2/3 isomorphic JSON editor, viewer, formatter and validator.",
77
"author": {

test/index.test.ts

+24-5
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,43 @@ import { mount } from '@vue/test-utils'
33
import { expect, it } from 'vitest'
44
import JsonEditorVue from '../src/index'
55

6-
it('string value in text mode', async () => {
6+
it('text mode', async () => {
77
const wrapper = mount(JsonEditorVue, {
88
props: {
99
mode: 'text',
1010
modelValue: '',
1111
},
1212
})
13-
await wrapper.setProps({ modelValue: 'abc' })
14-
expect(wrapper.vm.jsonEditor.get().json).toEqual('abc')
13+
14+
await wrapper.setProps({ modelValue: '123' })
15+
await nextTick()
16+
expect(wrapper.vm.jsonEditor.get().text).toEqual('123')
17+
18+
await wrapper.setProps({ modelValue: JSON.stringify({ a: 1 }) })
19+
await nextTick()
20+
expect(wrapper.vm.jsonEditor.get().text).toEqual(JSON.stringify({ a: 1 }))
21+
22+
await wrapper.setProps({ modelValue: { a: 1 } })
23+
await nextTick()
24+
expect(wrapper.vm.jsonEditor.get().json).toEqual({ a: 1 })
1525
})
1626

17-
it('string value in tree mode', async () => {
27+
it('tree mode', async () => {
1828
const wrapper = mount(JsonEditorVue, {
1929
props: {
2030
modelValue: null,
2131
},
2232
})
33+
34+
await wrapper.setProps({ modelValue: '123' })
35+
await nextTick()
36+
expect(wrapper.vm.jsonEditor.get().text).toEqual('123')
37+
2338
await wrapper.setProps({ modelValue: JSON.stringify({ a: 1 }) })
2439
await nextTick()
25-
expect(wrapper.vm.jsonEditor.get().json).toEqual(JSON.stringify({ a: 1 }))
40+
expect(wrapper.vm.jsonEditor.get().text).toEqual(JSON.stringify({ a: 1 }))
41+
42+
await wrapper.setProps({ modelValue: { a: 1 } })
43+
await nextTick()
44+
expect(wrapper.vm.jsonEditor.get().json).toEqual({ a: 1 })
2645
})

0 commit comments

Comments
 (0)