diff --git a/cypress/e2e/scroll.cy.js b/cypress/e2e/scroll.cy.js new file mode 100644 index 0000000..ef042fa --- /dev/null +++ b/cypress/e2e/scroll.cy.js @@ -0,0 +1,18 @@ +describe('template spec', () => { + beforeEach(() => { + cy.visit('./../scroll-to-top.html') + }) + + it('Apparition button scroll top', () => { + cy.scrollTo('bottom') + cy.get('div.fixed[ x-data ]').should('be.visible') + }) + + it('Retour en haut et disparition du bouton scroll top', () => { + cy.scrollTo('bottom') + cy.get('div.fixed[ x-data ]').should('be.visible') + cy.get('div.fixed[ x-data ] button').click() + cy.window().its('scrollY').should('eq', 0) + cy.get('div.fixed[ x-data ]').should('not.be.visible') + }) +}) \ No newline at end of file diff --git a/scroll-to-top.html b/scroll-to-top.html new file mode 100644 index 0000000..f3bb4d0 --- /dev/null +++ b/scroll-to-top.html @@ -0,0 +1,66 @@ + + + + + + Scroll to top, with Tailwind CSS + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +

Scroll top fixed button

+

Alpine JS & Tailwind CSS

+
+
+ +
+ +
+ + + + \ No newline at end of file