test enter submits add child form

assert that pressing enter while typing in the add-child input
submits the form. currently fails: only the save-child button
click triggers the post.
This commit is contained in:
Yisroel Baum 2026-05-01 11:53:06 +03:00
parent 838c31293e
commit 74705379cb
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -101,6 +101,25 @@ describe('The admin text detail page', () => {
.should('contain', 'Shemos')
})
it('pressing Enter in the add-child input submits', () => {
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('Enter Child{enter}')
cy.wait('@createNode').its('response.statusCode').should('eq', 201)
cy.wait('@getNodesRefresh')
cy.get('#text-detail li').should('contain', 'Enter Child')
})
it('newly added child persists after page reload', () => {
cy.intercept('POST', '/api/nodes').as('createNode')
cy.intercept('GET', '/api/nodes/0').as('getNodesRefresh')