]> git.ipfire.org Git - thirdparty/vuejs/create-vue.git/commitdiff
feat: add tests in default templates
authorHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 26 Jul 2021 11:19:59 +0000 (19:19 +0800)
committerHaoqun Jiang <haoqunjiang@gmail.com>
Mon, 26 Jul 2021 11:19:59 +0000 (19:19 +0800)
template/code/default/src/components/__tests__/HelloWorld.spec.js [new file with mode: 0644]
template/code/typescript-default/src/components/__tests__/HelloWorld.spec.ts [new file with mode: 0644]

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 (file)
index 0000000..087c956
--- /dev/null
@@ -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 (file)
index 0000000..087c956
--- /dev/null
@@ -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')
+  })
+})