seed sibling node in layout test
This commit is contained in:
parent
bac29ba737
commit
c493bef13d
1 changed files with 23 additions and 4 deletions
|
|
@ -30,12 +30,31 @@ describe('The admin text detail page horizontal layout', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('stacks sibling child nodes vertically within the right column', () => {
|
it('stacks sibling child nodes vertically within the right column', () => {
|
||||||
|
cy.intercept('POST', '/api/nodes').as('createNode')
|
||||||
|
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')
|
||||||
|
|
||||||
|
cy.get('#text-detail > ul > li')
|
||||||
|
.first()
|
||||||
|
.children('button.add-child')
|
||||||
|
.click()
|
||||||
|
cy.get('#text-detail > ul > li')
|
||||||
|
.first()
|
||||||
|
.children('input.child-title')
|
||||||
|
.type('Sibling One{enter}')
|
||||||
|
cy.wait('@createNode')
|
||||||
|
cy.wait('@getNodesRefresh')
|
||||||
|
|
||||||
|
cy.get('#text-detail > ul > li > ul > li').should(
|
||||||
|
'have.length.greaterThan',
|
||||||
|
1
|
||||||
|
)
|
||||||
|
|
||||||
cy.get('#text-detail > ul > li > ul > li').then(($siblings) => {
|
cy.get('#text-detail > ul > li > ul > li').then(($siblings) => {
|
||||||
expect($siblings.length).to.be.greaterThan(1)
|
|
||||||
const firstRect = $siblings[0].getBoundingClientRect()
|
const firstRect = $siblings[0].getBoundingClientRect()
|
||||||
const secondRect = $siblings[1].getBoundingClientRect()
|
const lastRect = $siblings[$siblings.length - 1]
|
||||||
expect(secondRect.top).to.be.greaterThan(firstRect.top)
|
.getBoundingClientRect()
|
||||||
expect(Math.abs(secondRect.left - firstRect.left)).to.be.lessThan(2)
|
expect(lastRect.top).to.be.greaterThan(firstRect.top)
|
||||||
|
expect(Math.abs(lastRect.left - firstRect.left)).to.be.lessThan(2)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue