From 0842c5c0ca597e630dd173d99e2a9f2e519ee67a Mon Sep 17 00:00:00 2001 From: "daniel.xiao" Date: Sun, 6 Dec 2020 14:51:24 +0800 Subject: [PATCH] test(ncform): add $ncformGetValue api testcase --- .../cypress/integration/examples/others.spec.js | 7 +++++++ .../examples/components/vue-ncform/_others.html | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/ncform-e2e/ncform/cypress/integration/examples/others.spec.js b/packages/ncform-e2e/ncform/cypress/integration/examples/others.spec.js index 9d6e5ea..1125035 100644 --- a/packages/ncform-e2e/ncform/cypress/integration/examples/others.spec.js +++ b/packages/ncform-e2e/ncform/cypress/integration/examples/others.spec.js @@ -87,4 +87,11 @@ context('Others', () => { }) }) + it('$ncformGetValue api', () => { + cy.window().then(win => { + let formName = 'form_' + md5('$ncformGetValue api'); + expect(win.Vue.prototype.$ncformGetValue(formName)).to.deep.equal({"showField":"1","obj":{"show":"1"},"arr":[{"show":"1"}]}); + }) + }) + }) diff --git a/packages/ncform/examples/components/vue-ncform/_others.html b/packages/ncform/examples/components/vue-ncform/_others.html index 45f51e7..d2ebcce 100644 --- a/packages/ncform/examples/components/vue-ncform/_others.html +++ b/packages/ncform/examples/components/vue-ncform/_others.html @@ -182,12 +182,13 @@ { id: md5('$ncformGetValue api'), title: '$ncformGetValue api', - formName: 'form_' + Math.random(), + formName: 'form_' + md5('$ncformGetValue api'), formSchema: { type: 'object', properties: { showField: { type: 'string', + value: '1' }, hiddenField: { type: 'string', @@ -199,7 +200,8 @@ type: 'object', properties: { show: { - type: 'string' + type: 'string', + value: '1' }, hide: { type: 'string', @@ -215,7 +217,8 @@ type: 'object', properties: { show: { - type: 'string' + type: 'string', + value: '1' }, hide: { type: 'string', @@ -224,7 +227,8 @@ }, } } - } + }, + value: [{show: '1', hidden: ''}] } }, globalConfig: {