From 386a643465bf2e71d538916ffdcb7d6dd9252beb Mon Sep 17 00:00:00 2001 From: Ernest Date: Sun, 2 May 2021 15:28:09 +0800 Subject: [PATCH] test: add slot tests --- .../slots/dropdown-item/index.html | 45 +++++++++++++++ .../slots/dropdown-item/index.spec.js | 11 ++++ cypress/integration/slots/loading/index.html | 56 +++++++++++++++++++ .../integration/slots/loading/index.spec.js | 17 ++++++ cypress/integration/slots/tag/index.html | 47 ++++++++++++++++ cypress/integration/slots/tag/index.spec.js | 11 ++++ cypress/integration/slots/toggle/index.html | 45 +++++++++++++++ .../integration/slots/toggle/index.spec.js | 15 +++++ 8 files changed, 247 insertions(+) create mode 100644 cypress/integration/slots/dropdown-item/index.html create mode 100644 cypress/integration/slots/dropdown-item/index.spec.js create mode 100644 cypress/integration/slots/loading/index.html create mode 100644 cypress/integration/slots/loading/index.spec.js create mode 100644 cypress/integration/slots/tag/index.html create mode 100644 cypress/integration/slots/tag/index.spec.js create mode 100644 cypress/integration/slots/toggle/index.html create mode 100644 cypress/integration/slots/toggle/index.spec.js diff --git a/cypress/integration/slots/dropdown-item/index.html b/cypress/integration/slots/dropdown-item/index.html new file mode 100644 index 00000000..3b6d88a2 --- /dev/null +++ b/cypress/integration/slots/dropdown-item/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + +
+ + + + diff --git a/cypress/integration/slots/dropdown-item/index.spec.js b/cypress/integration/slots/dropdown-item/index.spec.js new file mode 100644 index 00000000..cd14e1b4 --- /dev/null +++ b/cypress/integration/slots/dropdown-item/index.spec.js @@ -0,0 +1,11 @@ +/// +import path from 'path' + +context('dropdown-item', () => { + it('should expose slot', () => { + cy.visit(path.join(__dirname, 'index.html')) + cy.get('.vue-select').click() + + cy.get('.vue-dropdown-item').should('have.text', 'I') + }) +}) diff --git a/cypress/integration/slots/loading/index.html b/cypress/integration/slots/loading/index.html new file mode 100644 index 00000000..6714d8f3 --- /dev/null +++ b/cypress/integration/slots/loading/index.html @@ -0,0 +1,56 @@ + + + + + + + + + + +
+ + + + diff --git a/cypress/integration/slots/loading/index.spec.js b/cypress/integration/slots/loading/index.spec.js new file mode 100644 index 00000000..64b6cda6 --- /dev/null +++ b/cypress/integration/slots/loading/index.spec.js @@ -0,0 +1,17 @@ +/// +import path from 'path' + +context('loading', () => { + it('should expose slot', () => { + cy.visit(path.join(__dirname, 'index.html')) + + cy.get('#custom-loading').should('not.exist') + + cy.get('input').type('i') + cy.get('#custom-loading').should('exist') + + cy.wait(100).then(() => { + cy.get('#custom-loading').should('not.exist') + }) + }) +}) diff --git a/cypress/integration/slots/tag/index.html b/cypress/integration/slots/tag/index.html new file mode 100644 index 00000000..1587dca0 --- /dev/null +++ b/cypress/integration/slots/tag/index.html @@ -0,0 +1,47 @@ + + + + + + + + + + +
+ + + + diff --git a/cypress/integration/slots/tag/index.spec.js b/cypress/integration/slots/tag/index.spec.js new file mode 100644 index 00000000..612aa825 --- /dev/null +++ b/cypress/integration/slots/tag/index.spec.js @@ -0,0 +1,11 @@ +/// +import path from 'path' + +context('tag', () => { + it('should expose slot', () => { + cy.visit(path.join(__dirname, 'index.html')) + cy.get('.vue-select').click() + + cy.get('.vue-tag').should('have.text', 'I') + }) +}) diff --git a/cypress/integration/slots/toggle/index.html b/cypress/integration/slots/toggle/index.html new file mode 100644 index 00000000..028b4f11 --- /dev/null +++ b/cypress/integration/slots/toggle/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + +
+ + + + diff --git a/cypress/integration/slots/toggle/index.spec.js b/cypress/integration/slots/toggle/index.spec.js new file mode 100644 index 00000000..8e595763 --- /dev/null +++ b/cypress/integration/slots/toggle/index.spec.js @@ -0,0 +1,15 @@ +/// +import path from 'path' + +context('toggle', () => { + it('should expose slot', () => { + cy.visit(path.join(__dirname, 'index.html')) + + cy.get('#custom-toggle').should('exist') + cy.get('#custom-toggle').should('have.text', 'Closing') + + cy.get('#custom-toggle').click() + + cy.get('#custom-toggle').should('have.text', 'Opening') + }) +})