Skip to content

Commit 96988a5

Browse files
committed
test(CodeEditor): fix flaky disabled-swap test by queueing setProps
setProps ran synchronously inside .then(), before the queued 'contenteditable=false' assertion — racing Vue's disabled watcher that flips it back to editable. Wrap setProps in cy.then() so it joins the command queue after the initial assertion.
1 parent 6928e63 commit 96988a5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/components/CodeEditor/CodeEditor.cy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,12 @@ describe('CodeEditor', () => {
7575
cy.mount(CodeEditor, {
7676
props: { modelValue: 'frozen', disabled: true },
7777
}).then(({ wrapper }) => {
78+
// `setProps` is synchronous JS, so it must be wrapped in `cy.then` to join
79+
// the command queue *after* the first assertion — otherwise it flips the
80+
// prop before that assertion runs and the initial `false` state is never
81+
// observed (the flake this guards against).
7882
cy.get('.cm-content').should('have.attr', 'contenteditable', 'false')
79-
wrapper.setProps({ disabled: false })
83+
cy.then(() => wrapper.setProps({ disabled: false }))
8084
cy.get('.cm-content').should('have.attr', 'contenteditable', 'true')
8185
})
8286
})

0 commit comments

Comments
 (0)