From 2430c5561a48639054d14f10d1ad0f417059618b Mon Sep 17 00:00:00 2001 From: thednp Date: Sun, 19 Nov 2023 20:10:55 +0200 Subject: [PATCH] update tests --- cypress/alert.html | 2 +- cypress/button.html | 2 +- cypress/carousel.html | 2 +- cypress/collapse.html | 2 +- cypress/dropdown.html | 2 +- cypress/e2e/alert.cy.ts | 4 ++-- cypress/e2e/carousel.cy.ts | 2 +- cypress/e2e/scrollspy.cy.ts | 5 +++-- cypress/e2e/toast.cy.ts | 4 ++-- cypress/e2e/tooltip.cy.ts | 12 +++++++----- cypress/modal.html | 2 +- cypress/offcanvas.html | 2 +- cypress/popover.html | 2 +- cypress/scrollspy.html | 2 +- cypress/tab.html | 2 +- cypress/toast.html | 2 +- cypress/tooltip.html | 2 +- docs/tooltip-iframe.html | 2 +- 18 files changed, 28 insertions(+), 25 deletions(-) diff --git a/cypress/alert.html b/cypress/alert.html index 3bc933c4..d3b249f1 100644 --- a/cypress/alert.html +++ b/cypress/alert.html @@ -3,7 +3,7 @@ BSN Testing Page - +

Alert Examples

diff --git a/cypress/button.html b/cypress/button.html index 209050b4..0f297190 100644 --- a/cypress/button.html +++ b/cypress/button.html @@ -3,7 +3,7 @@ BSN Testing Page - +

Button Example

diff --git a/cypress/carousel.html b/cypress/carousel.html index 89a631bd..91997bba 100644 --- a/cypress/carousel.html +++ b/cypress/carousel.html @@ -3,7 +3,7 @@ BSN Testing Page - + diff --git a/cypress/dropdown.html b/cypress/dropdown.html index aa9f5048..b1c420be 100644 --- a/cypress/dropdown.html +++ b/cypress/dropdown.html @@ -3,7 +3,7 @@ BSN Testing Page - + diff --git a/cypress/e2e/alert.cy.ts b/cypress/e2e/alert.cy.ts index 5851aed4..70ccd085 100644 --- a/cypress/e2e/alert.cy.ts +++ b/cypress/e2e/alert.cy.ts @@ -60,9 +60,9 @@ describe('Alert Class Tests', () => { cy.wrap(instance).as('instance'); }) cy.get('@instance').invoke('dispose') - .then(() => { + // .then(() => { cy.get('[data-cy="alert"]').should('exist'); - }) + // }) cy.get('@instance').its('element').should('be.undefined'); }); diff --git a/cypress/e2e/carousel.cy.ts b/cypress/e2e/carousel.cy.ts index 9cebb7b2..3d43b406 100644 --- a/cypress/e2e/carousel.cy.ts +++ b/cypress/e2e/carousel.cy.ts @@ -488,7 +488,7 @@ describe('Carousel Class Tests', () => { e.next(); const newInstance = new Carousel($element[0]); expect(newInstance.element).not.to.be.undefined; - expect(e.element).to.be.undefined; + expect(e.element).to.be.eq(newInstance.element); }) }) }); diff --git a/cypress/e2e/scrollspy.cy.ts b/cypress/e2e/scrollspy.cy.ts index 1ad788a3..93409ffe 100644 --- a/cypress/e2e/scrollspy.cy.ts +++ b/cypress/e2e/scrollspy.cy.ts @@ -63,7 +63,7 @@ describe('ScrollSpy Class Tests', () => { const content = doc.querySelector('.col-md-9 .row')?.cloneNode(true) as Node; doc.body.innerHTML = ''; doc.body.append(content); - Object.assign(doc.body.style, {padding: '5rem'}); + Object.assign(doc.body.style, {padding: '5rem 0'}); const disposableSpy = doc.getElementById('disposableSpy') as HTMLElement; const [nav] = doc.getElementsByTagName('nav'); @@ -89,10 +89,11 @@ describe('ScrollSpy Class Tests', () => { cy.window().trigger('resize', { force: true }) cy.wait(200) cy.get('@pageInstance').its('scrollTarget').scrollTo('bottom') - cy.wait(200) cy.get('@pageInstance').its('items').then(itms => { cy.wrap(itms).eq(4).should('have.class', 'active') }) + // cy.get('@pageInstance').its('items').eq(4).should('have.class', 'active') + cy.viewport(680,1000) }); diff --git a/cypress/e2e/toast.cy.ts b/cypress/e2e/toast.cy.ts index 6fd5d674..4d3c76df 100644 --- a/cypress/e2e/toast.cy.ts +++ b/cypress/e2e/toast.cy.ts @@ -38,10 +38,10 @@ describe('Toast Class Tests', () => { cy.get('@instance').its('element').should('have.class', 'show').and('be.visible') cy.get('@instance').its('isShown').should('be.true') cy.wait(250) - cy.get('@instance').then(() => { + // cy.get('@instance').then(() => { cy.get('@instance').its('isShown').should('be.false') cy.get('@instance').its('element').should('not.have.class', 'show') - }) + // }) }) }); diff --git a/cypress/e2e/tooltip.cy.ts b/cypress/e2e/tooltip.cy.ts index 360d97e7..8f05e23c 100644 --- a/cypress/e2e/tooltip.cy.ts +++ b/cypress/e2e/tooltip.cy.ts @@ -258,7 +258,7 @@ describe('Tooltip Class Tests', () => { doc.querySelector('.btn-toolbar')?.append(popoverTarget); }) .get('[data-bs-toggle="popover"]').then(($element) => { - const element = $element[0]; + const [element] = $element; // const HTML = element.ownerDocument.documentElement; const template = element.ownerDocument.createElement('div'); template.innerHTML = `