test: use id for tests

This commit is contained in:
Nick the Sick 2024-10-18 16:36:11 +02:00
parent a2eea24b5b
commit bfcf6d94e8
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC
2 changed files with 10 additions and 5 deletions

View File

@ -6,23 +6,23 @@ context('/src/Examples/Transition/Vue/', () => {
it('should not have an active tiptap instance but a button', () => {
cy.get('.tiptap').should('not.exist')
cy.get('button').should('exist')
cy.get('#toggle-editor').should('exist')
})
it('clicking the button should show the editor', () => {
cy.get('button').click()
cy.get('#toggle-editor').click()
cy.get('.tiptap').should('exist')
cy.get('.tiptap').should('be.visible')
})
it('clicking the button again should hide the editor', () => {
cy.get('button').click()
cy.get('#toggle-editor').click()
cy.get('.tiptap').should('exist')
cy.get('.tiptap').should('be.visible')
cy.get('button').click()
cy.get('#toggle-editor').click()
cy.get('.tiptap').should('not.exist')
})

View File

@ -34,7 +34,12 @@ const showEditor = ref(false)
<template>
<div>
<button type="button" @click="showEditor = !showEditor" style="margin-bottom: 1rem;">
<button
type="button"
@click="showEditor = !showEditor"
style="margin-bottom: 1rem;"
id="toggle-editor"
>
{{ showEditor ? 'Hide editor' : 'Show editor' }}
</button>