diff --git a/browser/css/device-mobile.css b/browser/css/device-mobile.css index 2132e34b4..cf7c200e8 100644 --- a/browser/css/device-mobile.css +++ b/browser/css/device-mobile.css @@ -330,24 +330,18 @@ nav:not(.spreadsheet-color-indicator) ~ #toolbar-wrapper #toolbar-up.w2ui-toolba top: 100%; margin-top: -3px; } -#toolbar-search #tb_searchbar_item_search *{ +#toolbar-search #search *{ width: 100% !important; } #toolbar-search input#search-input{ font-size: 16px; } -#toolbar-search #tb_searchbar_item_left, #tb_searchbar_right { - display: none; -} -#toolbar-search #tb_searchbar_item_hidesearchbar{ +#toolbar-search #hidesearchbar{ padding: 1px 8px !important; } -#toolbar-search #tb_searchbar_item_search{ +#toolbar-search #search{ width: 80%; } -#toolbar-search #search-input-group > label{ - display: none; -} .context-menu-link{ display: flex; flex-direction: row; diff --git a/browser/src/control/Control.SearchBar.js b/browser/src/control/Control.SearchBar.js index 50f5afe35..25c305b5b 100644 --- a/browser/src/control/Control.SearchBar.js +++ b/browser/src/control/Control.SearchBar.js @@ -9,92 +9,79 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ /* - * L.Control.SearchBar + * MobileSearchBar - mobile search bar */ -/* global $ w2ui _ _UNO app */ -L.Control.SearchBar = L.Control.extend({ +/* global _ _UNO */ +class MobileSearchBar { - onAdd: function (map) { + constructor(map) { this.map = map; + this.parentContainer = document.getElementById('toolbar-search'); + L.DomUtil.addClass(this.parentContainer, 'ui-toolbar'); + + this.builder = new L.control.jsDialogBuilder({ + mobileWizard: this, + map: this.map, + cssClass: 'jsdialog', + noLabelsForUnoButtons: true, + }); + this.create(); - }, - - create: function() { - var that = this; - var toolbar = $('#toolbar-search'); - toolbar.w2toolbar({ - name: 'searchbar', - items: [ - {type: 'button', id: 'hidesearchbar', img: 'unfold', hint: _('Hide the search bar')}, - { - type: 'html', id: 'search', - html: '
' + - ' ' + - ' ' + - '
' - }, - {type: 'button', id: 'searchprev', img: 'prev', hint: _UNO('.uno:UpSearch'), disabled: true}, - {type: 'button', id: 'searchnext', img: 'next', hint: _UNO('.uno:DownSearch'), disabled: true}, - {type: 'button', id: 'cancelsearch', img: 'cancel', hint: _('Clear the search field'), hidden: true}, - {type: 'html', id: 'left'} - ], - onClick: function (e) { - that.onClick(e, e.target, e.item, e.subItem); - }, - onRefresh: function () { - window.setupSearchInput(); - } - }); - this.map.uiManager.enableTooltip(toolbar); - - toolbar.bind('touchstart', function(e) { - w2ui['searchbar'].touchStarted = true; - var touchEvent = e.originalEvent; - if (touchEvent && touchEvent.touches.length > 1) { - L.DomEvent.preventDefault(e); - } - }); - - $(w2ui.searchbar.box).find('.w2ui-scroll-left, .w2ui-scroll-right').hide(); - w2ui.searchbar.on('resize', function(target, e) { - e.isCancelled = true; - }); - }, - - onClick: function(e, id, item) { - if (w2ui['searchbar'].get(id) !== null) { - var toolbar = w2ui['searchbar']; - item = toolbar.get(id); - } - - this.map.preventKeyboardPopup(id); - - if (item.disabled) { - return; - } - - if (id === 'searchprev') { - this.map.search(L.DomUtil.get('search-input').value, true); - } - else if (id === 'searchnext') { - this.map.search(L.DomUtil.get('search-input').value); - } - else if (id === 'cancelsearch') { - this.map.cancelSearch(); - } - else if (id === 'hidesearchbar') { - $('#toolbar-search').hide(); - if (this.map.isEditMode()) - $('#toolbar-down').show(); - /** show edit button if only we are able to edit but in readonly mode */ - if (!app.isReadOnly() && this.map.isReadOnlyMode()) - $('#mobile-edit-button').show(); - } } -}); -L.control.searchBar = function () { - return new L.Control.SearchBar(); + showItem(command: string, show: boolean) { + this.builder.executeAction(this.parentContainer, { + control_id: command, + action_type: show ? 'show' : 'hide', + }); + } + + enableItem(command: string, enable: boolean) { + this.builder.executeAction(this.parentContainer, { + control_id: command, + action_type: enable ? 'enable' : 'disable', + }); + } + + getToolItems() { + return [ + { + type: 'customtoolitem', + id: 'hidesearchbar', + w2icon: 'unfold', + text: _('Hide the search bar'), + }, + { type: 'edit', id: 'search-input', placeholder: _('Search'), text: '' }, + { + type: 'customtoolitem', + id: 'searchprev', + text: _UNO('.uno:UpSearch'), + enabled: false, + }, + { + type: 'customtoolitem', + id: 'searchnext', + text: _UNO('.uno:DownSearch'), + enabled: false, + }, + { + type: 'customtoolitem', + id: 'cancelsearch', + text: _('Clear the search field'), + visible: false, + }, + { type: 'spacer', id: 'left' }, + ]; + } + + create() { + var items = this.getToolItems(); + this.builder.build(this.parentContainer, items); + window.setupSearchInput(); + } +}; + +L.control.searchBar = function (map) { + return new MobileSearchBar(map); }; diff --git a/browser/src/control/Control.Toolbar.js b/browser/src/control/Control.Toolbar.js index c85f1b634..488df62ca 100644 --- a/browser/src/control/Control.Toolbar.js +++ b/browser/src/control/Control.Toolbar.js @@ -55,10 +55,6 @@ function getToolbarItemById(id) { toolbar = w2ui['actionbar']; item = toolbar.get(id); } - else if (w2ui['searchbar'].get(id) !== null) { - toolbar = w2ui['searchbar']; - item = toolbar.get(id); - } else { throw new Error('unknown id: ' + id); } @@ -812,28 +808,21 @@ function unoCmdToToolbarId(commandname) } function updateSearchButtons() { - var toolbar = window.mode.isMobile() ? w2ui['searchbar'] : null; - var statusBar = app.map.statusBar; + var toolbar = window.mode.isMobile() ? app.map.mobileSearchBar: app.map.statusBar; + if (!toolbar) { + console.debug('Cannot find search bar'); + return; + } + // conditionally disabling until, we find a solution for tdf#108577 if (L.DomUtil.get('search-input').value === '') { - if (statusBar) { - statusBar.enableItem('searchprev', false); - statusBar.enableItem('searchnext', false); - statusBar.showItem('cancelsearch', false); - } else { - toolbar.disable('searchprev'); - toolbar.disable('searchnext'); - toolbar.hide('cancelsearch'); - } - } - else if (statusBar) { - statusBar.enableItem('searchprev', true); - statusBar.enableItem('searchnext', true); - statusBar.showItem('cancelsearch', true); + toolbar.enableItem('searchprev', false); + toolbar.enableItem('searchnext', false); + toolbar.showItem('cancelsearch', false); } else { - toolbar.enable('searchprev'); - toolbar.enable('searchnext'); - toolbar.show('cancelsearch'); + toolbar.enableItem('searchprev', true); + toolbar.enableItem('searchnext', true); + toolbar.showItem('cancelsearch', true); } } @@ -1216,7 +1205,11 @@ function setupToolbar(e) { map.on('search', function (e) { var searchInput = L.DomUtil.get('search-input'); - var toolbar = app.map.statusBar; + var toolbar = window.mode.isMobile() ? app.map.mobileSearchBar: app.map.statusBar; + if (!toolbar) { + console.debug('Cannot find search bar'); + return; + } if (e.count === 0) { toolbar.enableItem('searchprev', false); toolbar.enableItem('searchnext', false); diff --git a/browser/src/control/Control.UIManager.js b/browser/src/control/Control.UIManager.js index 6019c7198..2e33c1797 100644 --- a/browser/src/control/Control.UIManager.js +++ b/browser/src/control/Control.UIManager.js @@ -296,7 +296,7 @@ L.Control.UIManager = L.Control.extend({ this.map.addControl(L.control.mobileBottomBar(docType)); this.map.mobileTopBar = L.control.mobileTopBar(docType); this.map.addControl(this.map.mobileTopBar); - this.map.addControl(L.control.searchBar()); + this.map.mobileSearchBar = L.control.searchBar(this.map); } else if (enableNotebookbar) { this.createNotebookbarControl(docType); // makeSpaceForNotebookbar call in onUpdatePermission diff --git a/browser/src/control/Toolbar.js b/browser/src/control/Toolbar.js index 6b49a5102..e0c6faaaf 100644 --- a/browser/src/control/Toolbar.js +++ b/browser/src/control/Toolbar.js @@ -12,7 +12,7 @@ * Toolbar handler */ -/* global app $ window sanitizeUrl brandProductName brandProductURL _ w2ui */ +/* global app $ window sanitizeUrl brandProductName brandProductURL _ */ L.Map.include({ // a mapping of uno commands to more readable toolbar items @@ -1007,24 +1007,19 @@ L.Map.include({ }, cancelSearch: function() { - var toolbar = window.mode.isMobile() ? w2ui['searchbar'] : null; - var statusBar = this.statusBar; + var toolbar = window.mode.isMobile() ? app.map.mobileSearchBar: app.map.statusBar; var searchInput = L.DomUtil.get('search-input'); this.resetSelection(); if (toolbar) { - toolbar.hide('cancelsearch'); - toolbar.disable('searchprev'); - toolbar.disable('searchnext'); - } else if (statusBar) { - statusBar.showItem('cancelsearch', false); - statusBar.enableItem('searchprev', false); - statusBar.enableItem('searchnext', false); + toolbar.showItem('cancelsearch', false); + toolbar.enableItem('searchprev', false); + toolbar.enableItem('searchnext', false); } searchInput.value = ''; if (window.mode.isMobile()) { searchInput.focus(); // odd, but on mobile we need to invoke it twice - toolbar.hide('cancelsearch'); + toolbar.showItem('cancelsearch', false); } this._onGotFocus(); diff --git a/browser/src/docdispatcher.ts b/browser/src/docdispatcher.ts index f4a3c8b9f..a52fe922c 100644 --- a/browser/src/docdispatcher.ts +++ b/browser/src/docdispatcher.ts @@ -218,6 +218,13 @@ class Dispatcher { this.actionsMap['cancelsearch'] = () => { app.map.cancelSearch(); }; + this.actionsMap['hidesearchbar'] = () => { + $('#toolbar-search').hide(); + if (app.map.isEditMode()) $('#toolbar-down').show(); + /** show edit button if only we are able to edit but in readonly mode */ + if (!app.isReadOnly() && app.map.isReadOnlyMode()) + $('#mobile-edit-button').show(); + }; this.actionsMap['prev'] = () => { if (app.map._docLayer._docType === 'text') app.map.goToPage('prev'); diff --git a/cypress_test/integration_tests/common/search_helper.js b/cypress_test/integration_tests/common/search_helper.js index 57b0a1678..dd2138f8a 100644 --- a/cypress_test/integration_tests/common/search_helper.js +++ b/cypress_test/integration_tests/common/search_helper.js @@ -9,9 +9,9 @@ function showSearchBar() { cy.cGet('#tb_editbar_item_showsearchbar .w2ui-button').click(); cy.cGet('input#search-input').should('be.visible'); cy.cGet('#tb_editbar_item_bold .w2ui-button').should('not.be.visible'); - cy.cGet('#tb_searchbar_item_searchprev').should('have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_searchnext').should('have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_cancelsearch').should('not.be.visible'); + cy.cGet('#searchprev').should('have.attr', 'disabled'); + cy.cGet('#searchnext').should('have.attr', 'disabled'); + cy.cGet('#cancelsearch').should('not.be.visible'); cy.log('<< showSearchBar - end'); } @@ -20,20 +20,8 @@ function showSearchBar() { // trigger searching automatically. // Parameters: // text - the text to type in -function tpyeIntoSearchField(text) { - cy.log('>> tpyeIntoSearchField - start'); - - cy.cGet('input#search-input').clear().type(text); - cy.cGet('input#search-input').should('have.prop', 'value', text); - cy.cGet('#tb_searchbar_item_searchprev').should('not.have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_searchnext').should('not.have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_cancelsearch').should('be.visible'); - - cy.log('<< tpyeIntoSearchField - end'); -} - -function typeIntoSearchFieldDesktop(text) { - cy.log('>> typeIntoSearchFieldDesktop - start'); +function typeIntoSearchField(text) { + cy.log('>> typeIntoSearchField - start'); cy.cGet('input#search-input').clear().type(text); cy.cGet('input#search-input').should('have.prop', 'value', text); @@ -41,41 +29,25 @@ function typeIntoSearchFieldDesktop(text) { cy.cGet('#searchnext').should('not.have.attr', 'disabled'); cy.cGet('#cancelsearch').should('be.visible'); - cy.log('<< typeIntoSearchFieldDesktop - end'); + cy.log('<< typeIntoSearchField - end'); } // Move to the next search result in the document. function searchNext() { cy.log('>> searchNext - start'); - cy.cGet('#tb_searchbar_item_searchnext').click(); - - cy.log('<< searchNext - end'); -} - -function searchNextDesktop() { - cy.log('>> searchNextDesktop - start'); - cy.cGet('#searchnext').click(); - cy.log('<< searchNextDesktop - end'); + cy.log('<< searchNext - end'); } // Move to the previous search result in the document. function searchPrev() { cy.log('>> searchPrev - start'); - cy.cGet('#tb_searchbar_item_searchprev').click(); - - cy.log('<< searchPrev - end'); -} - -function searchPrevDesktop() { - cy.log('>> searchPrevDesktop - start'); - cy.cGet('#searchprev').click(); - cy.log('<< searchPrevDesktop - end'); + cy.log('<< searchPrev - end'); } // Cancel search with the specified text. @@ -83,32 +55,20 @@ function searchPrevDesktop() { function cancelSearch() { cy.log('>> cancelSearch - start'); - cy.cGet('#tb_searchbar_item_cancelsearch').click(); + cy.cGet('#cancelsearch').click(); cy.cGet('input#search-input').should('have.prop', 'value', ''); - cy.cGet('#tb_searchbar_item_searchprev').should('have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_searchnext').should('have.class', 'disabled'); - cy.cGet('#tb_searchbar_item_cancelsearch').should('not.be.visible'); + cy.cGet('#searchprev').should('have.attr', 'disabled'); + cy.cGet('#searchnext').should('have.attr', 'disabled'); + cy.cGet('#cancelsearch').should('not.be.visible'); cy.log('<< cancelSearch - end'); } -function cancelSearchDesktop() { - cy.log('>> cancelSearchDesktop - start'); - - cy.cGet('#toolbar-down #cancelsearch').click(); - cy.cGet('input#search-input').should('have.prop', 'value', ''); - cy.cGet('#toolbar-down #searchprev').should('have.attr', 'disabled'); - cy.cGet('#toolbar-down #searchnext').should('have.attr', 'disabled'); - cy.cGet('#toolbar-down #cancelsearch').should('not.be.visible'); - - cy.log('<< cancelSearchDesktop - end'); -} - // Hide the searchbar from the bottom toolbar. function closeSearchBar() { cy.log('>> closeSearchBar - start'); - cy.cGet('#tb_searchbar_item_hidesearchbar').click(); + cy.cGet('#hidesearchbar').click(); cy.cGet('input#search-input').should('not.be.visible'); cy.cGet('#tb_editbar_item_bold .w2ui-button').should('be.visible'); @@ -116,12 +76,8 @@ function closeSearchBar() { } module.exports.showSearchBar = showSearchBar; -module.exports.tpyeIntoSearchField = tpyeIntoSearchField; -module.exports.typeIntoSearchFieldDesktop = typeIntoSearchFieldDesktop; +module.exports.typeIntoSearchField = typeIntoSearchField; module.exports.searchNext = searchNext; -module.exports.searchNextDesktop = searchNextDesktop; module.exports.searchPrev = searchPrev; -module.exports.searchPrevDesktop = searchPrevDesktop; module.exports.cancelSearch = cancelSearch; -module.exports.cancelSearchDesktop = cancelSearchDesktop; module.exports.closeSearchBar = closeSearchBar; diff --git a/cypress_test/integration_tests/desktop/calc/searchbar_spec.js b/cypress_test/integration_tests/desktop/calc/searchbar_spec.js index 2d766a6c3..947c387ed 100644 --- a/cypress_test/integration_tests/desktop/calc/searchbar_spec.js +++ b/cypress_test/integration_tests/desktop/calc/searchbar_spec.js @@ -16,9 +16,9 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.' }); it('Search existing word.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); // First cell should be selected cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); @@ -28,63 +28,63 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.' it('Search not existing word.', function() { cy.cGet('input#addressInput').should('have.prop', 'value', 'A2'); - searchHelper.typeIntoSearchFieldDesktop('q'); + searchHelper.typeIntoSearchField('q'); // Should be no new selection cy.cGet('input#addressInput').should('have.prop', 'value', 'A2'); }); it('Search next / prev instance.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); - searchHelper.searchNextDesktop(); + searchHelper.typeIntoSearchField('a'); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); // Search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'B1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); // Search prev instance - searchHelper.searchPrevDesktop(); + searchHelper.searchPrev(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); }); it('Search wrap at document end', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); // Search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'B1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); // Search next instance, which is in the beginning of the document. - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); }); it('Cancel search.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); cy.cGet('#copy-paste-container table td').should('have.text', 'a'); // Cancel search -> selection removed - searchHelper.cancelSearchDesktop(); + searchHelper.cancelSearch(); cy.cGet('input#search-input').should('be.visible'); }); diff --git a/cypress_test/integration_tests/desktop/impress/searchbar_spec.js b/cypress_test/integration_tests/desktop/impress/searchbar_spec.js index 732d05fbe..9c729d693 100644 --- a/cypress_test/integration_tests/desktop/impress/searchbar_spec.js +++ b/cypress_test/integration_tests/desktop/impress/searchbar_spec.js @@ -16,8 +16,8 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { }); it('Search existing word.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); - searchHelper.searchNextDesktop(); + searchHelper.typeIntoSearchField('a'); + searchHelper.searchNext(); // A shape and some text should be selected //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -32,15 +32,15 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { helper.selectAllText(); cy.wait(2000); helper.textSelectionShouldExist(); - searchHelper.typeIntoSearchFieldDesktop('q'); - searchHelper.searchNextDesktop(); + searchHelper.typeIntoSearchField('q'); + searchHelper.searchNext(); helper.textSelectionShouldNotExist(); }); it('Search next / prev instance.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); // A shape and some text should be selected //cy.get('.transform-handler--rotate') @@ -52,7 +52,7 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { helper.expectTextForClipboard('a'); // Search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -69,7 +69,7 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { }); // Search prev instance - searchHelper.searchPrevDesktop(); + searchHelper.searchPrev(); //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -88,9 +88,9 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { }); it('Search wrap at the document end.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); // A shape and some text should be selected //cy.get('.transform-handler--rotate') @@ -103,7 +103,7 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { helper.getCursorPos('left', 'cursorOrigLeft'); // Search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -121,7 +121,7 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { }); // Search next instance, which is in the beginning of the document. - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -139,9 +139,9 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { }); }); it('Cancel search.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); //cy.get('.transform-handler--rotate') // .should('be.not.visible'); @@ -151,7 +151,7 @@ describe.skip(['tagdesktop'], 'Searching via search bar' ,function() { helper.expectTextForClipboard('a'); // Cancel search -> selection removed - searchHelper.cancelSearchDesktop(); + searchHelper.cancelSearch(); cy.cGet('.transform-handler--rotate') .should('not.exist'); diff --git a/cypress_test/integration_tests/desktop/writer/searchbar_spec.js b/cypress_test/integration_tests/desktop/writer/searchbar_spec.js index 543e23bff..b1153d261 100644 --- a/cypress_test/integration_tests/desktop/writer/searchbar_spec.js +++ b/cypress_test/integration_tests/desktop/writer/searchbar_spec.js @@ -17,7 +17,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar' }); it('Search existing word.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); // Part of the text should be selected helper.textSelectionShouldExist(); @@ -36,40 +36,40 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar' }); it('Search next / prev instance.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); cy.cGet('#copy-paste-container p b').should('not.exist'); //search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('#copy-paste-container p b').should('exist'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); // Search prev instance - searchHelper.searchPrevDesktop(); + searchHelper.searchPrev(); cy.cGet('#copy-paste-container p b').should('not.exist'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); }); it('Search wrap at document end.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); cy.cGet('#copy-paste-container p b').should('not.exist'); // Search next instance - searchHelper.searchNextDesktop(); + searchHelper.searchNext(); 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.searchNextDesktop(); + searchHelper.searchNext(); cy.cGet('#copy-paste-container p b').should('not.exist'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); }); it('Cancel search.', function() { - searchHelper.typeIntoSearchFieldDesktop('a'); + searchHelper.typeIntoSearchField('a'); // Part of the text should be selected helper.textSelectionShouldExist(); @@ -77,7 +77,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Searching via search bar' helper.expectTextForClipboard('a'); // Cancel search -> selection removed - searchHelper.cancelSearchDesktop(); + searchHelper.cancelSearch(); helper.textSelectionShouldNotExist(); diff --git a/cypress_test/integration_tests/mobile/calc/searchbar_spec.js b/cypress_test/integration_tests/mobile/calc/searchbar_spec.js index 08db6db5a..d5eeab5b5 100644 --- a/cypress_test/integration_tests/mobile/calc/searchbar_spec.js +++ b/cypress_test/integration_tests/mobile/calc/searchbar_spec.js @@ -21,7 +21,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.', }); it('Search existing word.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -33,14 +33,14 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.', it('Search not existing word.', function() { cy.cGet('input#addressInput').should('have.prop', 'value', 'A2'); - searchHelper.tpyeIntoSearchField('q'); + searchHelper.typeIntoSearchField('q'); // Should be no new selection cy.cGet('input#addressInput').should('have.prop', 'value', 'A2'); }); it('Search next / prev instance.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); @@ -60,7 +60,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.', }); it('Search at the document end.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -79,7 +79,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.', }); it('Cancel search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -92,7 +92,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Searching via search bar.', }); it('Close search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); cy.cGet('input#addressInput').should('have.prop', 'value', 'A1'); diff --git a/cypress_test/integration_tests/mobile/impress/searchbar_spec.js b/cypress_test/integration_tests/mobile/impress/searchbar_spec.js index 0e3e9806d..413b6d90a 100644 --- a/cypress_test/integration_tests/mobile/impress/searchbar_spec.js +++ b/cypress_test/integration_tests/mobile/impress/searchbar_spec.js @@ -22,7 +22,7 @@ describe.skip('Searching via search bar.', function() { }); it('Search existing word.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -44,7 +44,7 @@ describe.skip('Searching via search bar.', function() { helper.textSelectionShouldExist(); - searchHelper.tpyeIntoSearchField('q'); + searchHelper.typeIntoSearchField('q'); searchHelper.searchNext(); @@ -52,7 +52,7 @@ describe.skip('Searching via search bar.', function() { }); it('Search next / prev instance.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -101,7 +101,7 @@ describe.skip('Searching via search bar.', function() { }); it('Search at the document end.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -151,7 +151,7 @@ describe.skip('Searching via search bar.', function() { }); it('Cancel search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); @@ -170,7 +170,7 @@ describe.skip('Searching via search bar.', function() { }); it('Close search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); searchHelper.searchNext(); diff --git a/cypress_test/integration_tests/mobile/writer/searchbar_spec.js b/cypress_test/integration_tests/mobile/writer/searchbar_spec.js index 6b6de2789..68b44ecdc 100644 --- a/cypress_test/integration_tests/mobile/writer/searchbar_spec.js +++ b/cypress_test/integration_tests/mobile/writer/searchbar_spec.js @@ -20,7 +20,7 @@ describe.skip('Searching via search bar.', function() { }); it('Search existing word.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); // Part of the text should be selected helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); @@ -28,12 +28,12 @@ describe.skip('Searching via search bar.', function() { it('Search not existing word.', function() { writerHelper.selectAllTextOfDoc(); - searchHelper.tpyeIntoSearchField('q'); + searchHelper.typeIntoSearchField('q'); helper.textSelectionShouldNotExist(); }); it('Search next / prev instance.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); cy.cGet('#copy-paste-container p b').should('not.exist'); @@ -50,7 +50,7 @@ describe.skip('Searching via search bar.', function() { }); it('Search at the document end.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); cy.cGet('#copy-paste-container p b').should('not.exist'); @@ -67,7 +67,7 @@ describe.skip('Searching via search bar.', function() { }); it('Cancel search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); // Part of the text should be selected helper.textSelectionShouldExist(); helper.expectTextForClipboard('a'); @@ -78,7 +78,7 @@ describe.skip('Searching via search bar.', function() { }); it('Close search.', function() { - searchHelper.tpyeIntoSearchField('a'); + searchHelper.typeIntoSearchField('a'); // Part of the text should be selected helper.textSelectionShouldExist(); helper.expectTextForClipboard('a');