add tabindex tests
This commit is contained in:
parent
88c10d0321
commit
dc1a42ed29
45
cypress/integration/06-tabindex.js
Normal file
45
cypress/integration/06-tabindex.js
Normal file
|
@ -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')
|
||||
})
|
||||
})
|
|
@ -1,5 +1,5 @@
|
|||
<article class="status-article {{getClasses(originalStatus, timelineType, isStatusInOwnThread)}}"
|
||||
tabindex="{{ !isStatusInNotification || notification.type === 'follow' ? '0' : '' }}"
|
||||
tabindex="0"
|
||||
delegate-click-key="{{elementKey}}"
|
||||
delegate-keydown-key="{{elementKey}}"
|
||||
focus-key="{{elementKey}}"
|
||||
|
|
Loading…
Reference in a new issue