Skip to content

Commit

Permalink
fix(test): update code-dialog-format test
Browse files Browse the repository at this point in the history
  • Loading branch information
duyet committed Sep 25, 2024
1 parent 6dcafe2 commit 0cdd1de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions components/data-table/cells/code-dialog-format.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ describe('<CodeDialogFormat />', () => {
const shortCode = 'SELECT * FROM table'
cy.mount(<CodeDialogFormat value={shortCode} />)
cy.get('code').should('contain.text', shortCode)
cy.get('button svg[role="open-dialog"]').should('not.exist')
cy.get('svg[role="open-dialog"]').should('not.exist')
})

it('renders long code with dialog', () => {
const longCode =
'SELECT * FROM table WHERE column1 = "value" AND column2 > 100 ORDER BY column3 DESC LIMIT 10'
cy.mount(<CodeDialogFormat value={longCode} />)
cy.get('code').should('exist')
cy.get('button svg[role="open-dialog"]').should('exist')
cy.get('svg[role="open-dialog"]').should('exist')
})

it('opens dialog on button click', () => {
const longCode =
'SELECT * FROM table WHERE column1 = "value" AND column2 > 100 ORDER BY column3 DESC LIMIT 10'
cy.mount(<CodeDialogFormat value={longCode} />)
cy.get('button svg[role="open-dialog"]').click()
cy.get('svg[role="open-dialog"]').click()
cy.get('div[role="dialog"]').should('be.visible')
cy.get('div[role="dialog"] code').should('contain.text', longCode)
})
Expand All @@ -35,7 +35,7 @@ describe('<CodeDialogFormat />', () => {
hide_query_comment: true,
}
cy.mount(<CodeDialogFormat value={longCode} options={options} />)
cy.get('button svg[role="open-dialog"]').click()
cy.get('svg[role="open-dialog"]').click()
cy.get('div[role="dialog"]').within(() => {
cy.contains('Custom Title').should('be.visible')
cy.contains('Custom Description').should('be.visible')
Expand Down

0 comments on commit 0cdd1de

Please sign in to comment.