test only one add form open at a time

assert that opening any add-child or bulk-add form closes any
other open add form across the tree. currently fails: each toggle
function only checks for an open form on its own li.
This commit is contained in:
Yisroel Baum 2026-05-01 11:56:44 +03:00
parent bd14bfd7a1
commit d61d68571d
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -120,6 +120,60 @@ describe('The admin text detail page', () => {
cy.get('#text-detail li').should('contain', 'Enter Child')
})
it('opening add-child on another node closes the first one', () => {
cy.get('#text-detail > ul > li')
.first()
.children('button.add-child')
.click()
cy.get('#text-detail > ul > li')
.first()
.children('input.child-title')
.should('be.visible')
cy.get('#text-detail > ul > li > ul > li')
.first()
.children('button.add-child')
.click()
cy.get('#text-detail > ul > li')
.first()
.children('input.child-title')
.should('not.exist')
cy.get('#text-detail > ul > li')
.first()
.children('button.save-child')
.should('not.exist')
cy.get('#text-detail > ul > li > ul > li')
.first()
.children('input.child-title')
.should('be.visible')
})
it('opening bulk-add closes an open add-child form', () => {
cy.get('#text-detail > ul > li')
.first()
.children('button.add-child')
.click()
cy.get('#text-detail > ul > li')
.first()
.children('input.child-title')
.should('be.visible')
cy.get('#text-detail > ul > li > ul > li')
.first()
.children('button.bulk-add-children')
.click()
cy.get('#text-detail > ul > li')
.first()
.children('input.child-title')
.should('not.exist')
cy.get('#text-detail > ul > li > ul > li')
.first()
.children('input.bulk-title')
.should('be.visible')
})
it('newly added child persists after page reload', () => {
cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')