From: Haoqun Jiang Date: Mon, 26 Jul 2021 11:19:59 +0000 (+0800) Subject: feat: add tests in default templates X-Git-Tag: v3.0.0-alpha.2~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7974b2e94bcb9e62933b8177a09c257e9b1f4b4c;p=thirdparty%2Fvuejs%2Fcreate-vue.git feat: add tests in default templates --- diff --git a/template/code/default/src/components/__tests__/HelloWorld.spec.js b/template/code/default/src/components/__tests__/HelloWorld.spec.js new file mode 100644 index 00000000..087c9561 --- /dev/null +++ b/template/code/default/src/components/__tests__/HelloWorld.spec.js @@ -0,0 +1,22 @@ +import { mount } from '@cypress/vue' +import HelloWorld from '../HelloWorld.vue' + +describe('HelloWorld', () => { + it('playground', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + }) + + it('renders properly', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + cy.get('h1').should('contain', 'Hello Cypress') + }) + + it('adds 1 when clicking the plus button', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + + cy.get('button') + .should('contain', '0') + .click() + .should('contain', '1') + }) +}) diff --git a/template/code/typescript-default/src/components/__tests__/HelloWorld.spec.ts b/template/code/typescript-default/src/components/__tests__/HelloWorld.spec.ts new file mode 100644 index 00000000..087c9561 --- /dev/null +++ b/template/code/typescript-default/src/components/__tests__/HelloWorld.spec.ts @@ -0,0 +1,22 @@ +import { mount } from '@cypress/vue' +import HelloWorld from '../HelloWorld.vue' + +describe('HelloWorld', () => { + it('playground', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + }) + + it('renders properly', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + cy.get('h1').should('contain', 'Hello Cypress') + }) + + it('adds 1 when clicking the plus button', () => { + mount(HelloWorld, { props: { msg: 'Hello Cypress' } }) + + cy.get('button') + .should('contain', '0') + .click() + .should('contain', '1') + }) +})