Skip to content

Commit 944fdb4

Browse files
committed
fix(test): make sure to only get search decorations
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
1 parent 62fcf60 commit 944fdb4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cypress/component/editor/search.cy.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe('editor search highlighting', () => {
2727
const searchQuery = 'Lorem ipsum dolor sit amet'
2828
editor.commands.setSearchQuery(searchQuery)
2929

30-
const highlightedElements = document.querySelectorAll('span[data-text-el]')
30+
const highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
3131
expect(highlightedElements).to.have.lengthOf(1)
3232
verifyHighlights(highlightedElements, searchQuery)
3333
})
@@ -36,7 +36,7 @@ describe('editor search highlighting', () => {
3636
const searchQuery = 'quod'
3737
editor.commands.setSearchQuery(searchQuery)
3838

39-
const highlightedElements = document.querySelectorAll('span[data-text-el]')
39+
const highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
4040
expect(highlightedElements).to.have.lengthOf(3)
4141
verifyHighlights(highlightedElements, searchQuery)
4242
})
@@ -47,7 +47,7 @@ describe('editor search highlighting', () => {
4747

4848
// Highlight only first occurrence
4949
editor.commands.setSearchQuery(searchQuery, false)
50-
highlightedElements = document.querySelectorAll('span[data-text-el]')
50+
highlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
5151

5252
expect(highlightedElements).to.have.lengthOf(1)
5353
verifyHighlights(highlightedElements, searchQuery)
@@ -57,10 +57,10 @@ describe('editor search highlighting', () => {
5757
const searchQuery = 'quod'
5858

5959
editor.commands.setSearchQuery(searchQuery, true)
60-
const allHighlightedElements = document.querySelectorAll('span[data-text-el]')
60+
const allHighlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
6161

6262
editor.commands.nextMatch()
63-
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el]')
63+
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el="search-decoration"]')
6464

6565
expect(currentlyHighlightedElement).to.have.lengthOf(1)
6666
expect(allHighlightedElements[1]).to.deep.equal(currentlyHighlightedElement[0])
@@ -70,10 +70,10 @@ describe('editor search highlighting', () => {
7070
const searchQuery = 'quod'
7171

7272
editor.commands.setSearchQuery(searchQuery, true)
73-
const allHighlightedElements = document.querySelectorAll('span[data-text-el]')
73+
const allHighlightedElements = document.querySelectorAll('span[data-text-el="search-decoration"]')
7474

7575
editor.commands.previousMatch()
76-
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el]')
76+
const currentlyHighlightedElement = document.querySelectorAll('span[data-text-el="search-decoration"]')
7777

7878
expect(currentlyHighlightedElement).to.have.lengthOf(1)
7979
expect(allHighlightedElements[0]).to.deep.equal(currentlyHighlightedElement[0])

0 commit comments

Comments
 (0)