Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Jan 15, 2024
1 parent 1423a32 commit cb24dc6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions docs/recipes/selected-value.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,12 @@ Notice how the attribute value is quoted by Cypress, yet the value inside has a

```js
// select the option ourselves by setting its attribute
cy.get(
`#my-data option[value=${Cypress.$.escapeSelector(
'present"',
)}]`,
).invoke('attr', 'selected', 'selected')
const escaped = Cypress.$.escapeSelector('present"')
cy.get(`#my-data option[value=${escaped}]`).invoke(
'attr',
'selected',
'selected',
)
// check the selected value
cy.get('#my-data option:selected').should(
'have.text',
Expand Down

0 comments on commit cb24dc6

Please sign in to comment.