add test for pinned statuses

This commit is contained in:
Nolan Lawson 2018-02-19 09:17:22 -08:00
parent c133c25c67
commit 9dfe76692f
4 changed files with 40 additions and 7 deletions

View File

@ -60,10 +60,6 @@ describe('Basic timeline spec', () => {
{content: 'pinned toot 1'}
]
const pinnedStatuses = [
{content: 'this is unlisted'}
]
it('Shows the home timeline', () => {
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize')
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-posinset', '0')

View File

@ -0,0 +1,37 @@
describe('Pinned statuses', () => {
beforeEach(() => {
cy.login('foobar@localhost:3000', 'foobarfoobar')
cy.visit('/')
cy.wait(500)
})
it("shows a user's pinned statuses", () => {
cy.get('nav a[aria-label=Community]').click()
cy.url().should('contain', '/community')
cy.get('a').contains('Pinned').click()
cy.url().should('contain', '/pinned')
cy.get('.status-article').should('have.attr', 'aria-posinset', '0')
cy.get('.status-article').should('have.attr', 'aria-setsize', '1')
cy.get('.status-article .status-content').should('contain', 'this is unlisted')
})
it("shows pinned statuses on a user's account page", () => {
cy.visit('/accounts/2')
cy.wait(500)
cy.get('.pinned-statuses .status-article').should('have.attr', 'aria-posinset', '0')
cy.get('.pinned-statuses .status-article').should('have.attr', 'aria-setsize', '1')
cy.get('.pinned-statuses .status-article').should('contain', 'this is unlisted')
})
it("shows pinned statuses on a user's account page 2", () => {
cy.visit('/accounts/3')
cy.wait(500)
cy.get('.pinned-statuses .status-article').should('have.attr', 'aria-posinset', '0')
cy.get('.pinned-statuses .status-article').should('have.attr', 'aria-setsize', '2')
cy.get('.pinned-statuses .status-article').should('contain', 'pinned toot 1')
cy.get('.pinned-statuses .status-article[aria-posinset=1]').should('have.attr', 'aria-setsize', '2')
cy.get('.pinned-statuses .status-article[aria-posinset=1]').should('contain', 'pinned toot 2')
})
})

View File

@ -1,4 +1,4 @@
<div role="feed" aria-label="Pinned toots" classes="pinned-statuses">
<div role="feed" aria-label="Pinned toots" class="pinned-statuses">
{{#if pinnedStatuses}}
{{#each pinnedStatuses as status, index}}
<Status :status

View File

@ -9,8 +9,8 @@
<LoadingPage />
{{elseif statuses && statuses.length}}
<ul class="pinned-toots-results">
{{#each statuses as status}}
<StatusSearchResult :status />
{{#each statuses as status, index}}
<StatusSearchResult :status :index length="{{statuses.length}}" />
{{/each}}
</ul>
{{/if}}