Skip to content

Commit

Permalink
cool#8648 clipboard: fix desktop/writer/searchbar_spec.js
Browse files Browse the repository at this point in the history
To work even if we don't automatically fetch HTML when a text selection
is created.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ia518a7f60c39109de82e0c9b38185ebe757df1cf
  • Loading branch information
vmiklos authored and caolanm committed Apr 15, 2024
1 parent 56adf99 commit 1e4afce
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cypress_test/integration_tests/desktop/writer/searchbar_spec.js
Expand Up @@ -17,11 +17,13 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar'
});

it('Search existing word.', function() {
helper.setDummyClipboardForCopy();
searchHelper.typeIntoSearchField('a');

// Part of the text should be selected
helper.textSelectionShouldExist();

helper.copy();
helper.expectTextForClipboard('a');
});

Expand All @@ -36,44 +38,54 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar'
});

it('Search next / prev instance.', function() {
helper.setDummyClipboardForCopy();
searchHelper.typeIntoSearchField('a');
helper.textSelectionShouldExist();
helper.copy();
helper.expectTextForClipboard('a');
cy.cGet('#copy-paste-container p b').should('not.exist');
//search next instance
searchHelper.searchNext();
helper.copy();
cy.cGet('#copy-paste-container p b').should('exist');
helper.textSelectionShouldExist();
helper.expectTextForClipboard('a');
// Search prev instance
searchHelper.searchPrev();
helper.copy();
cy.cGet('#copy-paste-container p b').should('not.exist');
helper.textSelectionShouldExist();
helper.expectTextForClipboard('a');
});
it('Search wrap at document end.', function() {
helper.setDummyClipboardForCopy();
searchHelper.typeIntoSearchField('a');
helper.textSelectionShouldExist();
helper.copy();
helper.expectTextForClipboard('a');
cy.cGet('#copy-paste-container p b').should('not.exist');
// Search next instance
searchHelper.searchNext();
helper.copy();
cy.cGet('#copy-paste-container p b').should('exist');
helper.textSelectionShouldExist();
helper.expectTextForClipboard('a');
// Search next instance, which is in the beginning of the document.
searchHelper.searchNext();
helper.copy();
cy.cGet('#copy-paste-container p b').should('not.exist');
helper.textSelectionShouldExist();
helper.expectTextForClipboard('a');
});

it('Cancel search.', function() {
helper.setDummyClipboardForCopy();
searchHelper.typeIntoSearchField('a');

// Part of the text should be selected
helper.textSelectionShouldExist();

helper.copy();
helper.expectTextForClipboard('a');

// Cancel search -> selection removed
Expand Down

0 comments on commit 1e4afce

Please sign in to comment.