From dc1a42ed293ceb00729f420bbf7f3f9668625156 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Mon, 19 Feb 2018 10:46:30 -0800 Subject: [PATCH] add tabindex tests --- cypress/integration/06-tabindex.js | 45 +++++++++++++++++++++++++++ routes/_components/status/Status.html | 2 +- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 cypress/integration/06-tabindex.js diff --git a/cypress/integration/06-tabindex.js b/cypress/integration/06-tabindex.js new file mode 100644 index 00000000..4d8663d8 --- /dev/null +++ b/cypress/integration/06-tabindex.js @@ -0,0 +1,45 @@ +describe('06-tabindex.js', () => { + beforeEach(() => { + cy.login('foobar@localhost:3000', 'foobarfoobar') + cy.wait(500) + }) + + it('shows correct tabindex in home timeline', () => { + cy.getNthVirtualArticle(0).should('have.attr', 'tabindex', '0') + cy.getNthVirtualArticle(2).should('have.attr', 'tabindex', '0') + cy.getNthVirtualArticle(3).should('have.attr', 'tabindex', '0') + }) + + it('shows correct tabindex in notifications', () => { + cy.visit('/notifications') + cy.wait(500) + cy.getNthVirtualArticle(0).should('have.attr', 'tabindex', '0') + .and('have.class', 'status-article') + cy.getNthVirtualArticle(1).should('have.attr', 'tabindex', '0') + .and('have.class', 'status-article') + cy.getNthVirtualArticle(2).should('have.attr', 'tabindex', '0') + .and('have.class', 'status-article') + cy.getNthVirtualArticle(3).should('have.attr', 'tabindex', '0') + .and('have.class', 'status-article') + cy.getNthVirtualArticle(4).should('have.attr', 'tabindex', '0') + cy.getNthVirtualArticle(4).scrollIntoView() + cy.wait(500) + cy.getNthVirtualArticle(5).should('have.attr', 'tabindex', '0') + .and('have.class', 'notification-article') + cy.getNthVirtualArticle(6).should('have.attr', 'tabindex', '0') + .and('have.class', 'status-article') + cy.getNthVirtualArticle(6).scrollIntoView() + cy.wait(500) + cy.getNthVirtualArticle(7).should('have.attr', 'tabindex', '0') + .and('have.attr', 'aria-setsize', '8') + .and('have.class', 'notification-article') + }) + + it('shows correct tabindex in pinned statuses', () => { + cy.visit('/pinned') + cy.wait(500) + cy.get('.status-article').should('have.attr', 'tabindex', '0') + .and('have.attr', 'aria-posinset', '0') + .and('have.attr', 'aria-setsize', '1') + }) +}) diff --git a/routes/_components/status/Status.html b/routes/_components/status/Status.html index 77698861..203d4fa7 100644 --- a/routes/_components/status/Status.html +++ b/routes/_components/status/Status.html @@ -1,5 +1,5 @@