From 8695bb4687c1e2c4270fe9f403ff866d6a9b5c19 Mon Sep 17 00:00:00 2001 From: daniel-dx Date: Sun, 10 Mar 2019 15:56:17 +0800 Subject: [PATCH] test: complete ui.help test cases --- .../integration/examples/ui.help.spec.js | 33 +++++ .../components/vue-ncform/_ui.help.html | 135 ++++++++++++++++++ .../vue-ncform/layout-comps/array-table.vue | 2 +- .../vue-ncform/layout-comps/object.vue | 7 +- 4 files changed, 172 insertions(+), 5 deletions(-) create mode 100644 packages/ncform-e2e/ncform/cypress/integration/examples/ui.help.spec.js create mode 100644 packages/ncform/examples/components/vue-ncform/_ui.help.html diff --git a/packages/ncform-e2e/ncform/cypress/integration/examples/ui.help.spec.js b/packages/ncform-e2e/ncform/cypress/integration/examples/ui.help.spec.js new file mode 100644 index 0000000..78ee391 --- /dev/null +++ b/packages/ncform-e2e/ncform/cypress/integration/examples/ui.help.spec.js @@ -0,0 +1,33 @@ +/// + +const md5 = require('blueimp-md5'); + +context('ui.help', () => { + + before(() => { + cy.visit('http://localhost:3000/examples/components/vue-ncform/_ui.help.html') + }) + + it('Show help', () => { + let id = md5('Show help'); + cy.get(`[data-cy=${id}]`).within(() => { + cy.get('legend').contains('user1').parent().find('label').as('label1'); + cy.get('@label1').find('.fa-question-circle').should('be.visible'); + cy.get('@label1').find('.fa-question-circle').parent('a').should('have.prop', 'title', 'Some help tips'); + + cy.get('legend').contains('user2').parent().find('label').as('label2'); + cy.get('@label2').find('a').should('have.prop', 'title', 'Some help tips'); + cy.get('@label2').find('a').should('have.text', '?'); + }) + }) + + it('Array-table: Show help', () => { + let id = md5('Array-table: Show help'); + cy.get(`[data-cy=${id}]`).within(() => { + cy.get('th').contains('users').as('header'); + cy.get('@header').find('.fa-question-circle').should('be.visible'); + cy.get('@header').find('.fa-question-circle').parent('a').should('have.prop', 'title', 'Some help tips'); + }) + }) + +}) diff --git a/packages/ncform/examples/components/vue-ncform/_ui.help.html b/packages/ncform/examples/components/vue-ncform/_ui.help.html new file mode 100644 index 0000000..106b6a0 --- /dev/null +++ b/packages/ncform/examples/components/vue-ncform/_ui.help.html @@ -0,0 +1,135 @@ + + + + + vue-ncform Example + + + + + + +
+ +
+ + + + + + + + diff --git a/packages/ncform/src/components/vue-ncform/layout-comps/array-table.vue b/packages/ncform/src/components/vue-ncform/layout-comps/array-table.vue index 98e7435..1c14c20 100755 --- a/packages/ncform/src/components/vue-ncform/layout-comps/array-table.vue +++ b/packages/ncform/src/components/vue-ncform/layout-comps/array-table.vue @@ -13,7 +13,7 @@ {{renderSchema.ui.label}} - {{renderSchema.ui.help.text}} + {{renderSchema.ui.help.text}} diff --git a/packages/ncform/src/components/vue-ncform/layout-comps/object.vue b/packages/ncform/src/components/vue-ncform/layout-comps/object.vue index 2a2def1..bd27c17 100755 --- a/packages/ncform/src/components/vue-ncform/layout-comps/object.vue +++ b/packages/ncform/src/components/vue-ncform/layout-comps/object.vue @@ -16,9 +16,8 @@ {{_analyzeVal(fieldSchema.ui.label)}} - - {{fieldSchema.ui.help.text}} + {{fieldSchema.ui.help.text}} @@ -43,9 +42,9 @@ * {{_analyzeVal(fieldSchema.ui.label)}} - + - {{fieldSchema.ui.help.text}} + {{fieldSchema.ui.help.text}} :