From ffeacbcb260023c65c920f4d5b3d24a987472081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Sun, 31 Mar 2024 22:13:05 +0200 Subject: [PATCH 1/5] jsdialog: use attribute not class for disabled state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - but still use class for css rules - after rework in styling to use attribute we can drop that Signed-off-by: Szymon Kłos Change-Id: I568eedf45440f6636c31430cb98adcfdeab6aa4e --- .../src/control/Control.JSDialogBuilder.js | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js index dd2ff424f1d4..9b8ffff849b5 100644 --- a/browser/src/control/Control.JSDialogBuilder.js +++ b/browser/src/control/Control.JSDialogBuilder.js @@ -14,7 +14,7 @@ * from the JSON description provided by the server. */ -/* global app $ w2ui _ L JSDialog */ +/* global app $ _ L JSDialog */ L.Control.JSDialogBuilder = L.Control.extend({ @@ -2320,14 +2320,17 @@ L.Control.JSDialogBuilder = L.Control.extend({ // empty, So, we ignore such messages or else the // current document's Paste toolbar button will // never be enabled. - $(div).removeClass('disabled'); + $(div).removeClass('disabled'); // TODO: remove after css rework + div.setAttribute('disabled', ''); window.app.console.log('do not disable paste based on server side data'); } else { - $(div).addClass('disabled'); + $(div).addClass('disabled'); // TODO: remove after css rework + div.setAttribute('disabled', ''); } } else { - $(div).removeClass('disabled'); + $(div).removeClass('disabled'); // TODO: remove after css rework + div.removeAttribute('disabled'); } }; @@ -2345,8 +2348,10 @@ L.Control.JSDialogBuilder = L.Control.extend({ }, this); } - if (disabled) - L.DomUtil.addClass(div, 'disabled'); + if (disabled) { + L.DomUtil.addClass(div, 'disabled'); // TODO: remove after css rework + div.setAttribute('disabled', ''); + } if (data.selected === true) { $(button).addClass('selected'); @@ -2370,7 +2375,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ L.DomUtil.create('i', 'unoarrow', arrowbackground); controls['arrow'] = arrowbackground; $(arrowbackground).click(function (event) { - if (!$(div).hasClass('disabled')) { + if (!div.hasAttribute('disabled')) { builder.callback('toolbox', 'openmenu', parentContainer, data.command, builder); event.stopPropagation(); } @@ -2382,7 +2387,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ } var clickFunction = function (e) { - if (!$(div).hasClass('disabled')) { + if (!div.hasAttribute('disabled')) { builder.refreshSidebar = true; if (data.postmessage) builder.map.fire('postMessage', {msgId: 'Clicked_Button', args: {Id: data.id} }); @@ -2409,7 +2414,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ builder._preventDocumentLosingFocusOnClick(div); if (data.enabled === 'false' || data.enabled === false) - $(button).prop('disabled', true); + div.setAttribute('disabled', ''); builder.map.hideRestrictedItems(data, controls['container'], controls['container']); builder.map.disableLockedItem(data, controls['container'], controls['container']); From 210b5557ce1ab0880ce9df2f8d02e85f7bdb65a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Sun, 31 Mar 2024 22:16:33 +0200 Subject: [PATCH 2/5] remove-w2ui: convert mobile top bar to JSDialogs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use dispatcher to invoke commands - TODO: checked state for buttons + cypress check Signed-off-by: Szymon Kłos Change-Id: I652a163ea0c831b47ce7725ffd0f9f190a98d9bf --- browser/css/device-mobile.css | 7 +- .../src/control/Control.JSDialogBuilder.js | 2 +- browser/src/control/Control.MobileTopBar.js | 243 ++++++------------ browser/src/control/Control.MobileWizard.js | 16 +- .../src/control/Control.MobileWizardWindow.js | 8 +- browser/src/control/Control.PartsPreview.js | 4 +- browser/src/control/Control.UIManager.js | 3 +- browser/src/control/Control.UserList.ts | 35 +-- browser/src/control/Toolbar.js | 43 ++-- browser/src/docdispatcher.ts | 62 +++++ .../integration_tests/common/calc_helper.js | 4 +- .../integration_tests/common/helper.js | 2 +- .../common/impress_helper.js | 4 +- .../common/interference_user_spec.js | 4 +- .../integration_tests/common/mobile_helper.js | 40 +-- .../mobile/calc/alignment_options_spec.js | 2 +- .../mobile/calc/annotation_spec.js | 2 +- .../mobile/calc/bottom_toolbar_spec.js | 2 +- .../mobile/calc/focus_spec.js | 6 +- .../mobile/calc/formulabar_spec.js | 4 +- .../mobile/calc/undo_redo_spec.js | 12 +- .../mobile/impress/annotation_spec.js | 2 +- .../mobile/impress/undo_redo_spec.js | 4 +- .../mobile/writer/annotation_spec.js | 2 +- .../mobile/writer/mobile_wizard_state_spec.js | 6 +- .../mobile/writer/toolbar_spec.js | 46 ++-- .../mobile/writer/undo_redo_spec.js | 4 +- 27 files changed, 263 insertions(+), 306 deletions(-) diff --git a/browser/css/device-mobile.css b/browser/css/device-mobile.css index 71352bdd9bfb..2132e34b4c23 100644 --- a/browser/css/device-mobile.css +++ b/browser/css/device-mobile.css @@ -164,7 +164,7 @@ textarea.cool-annotation-textarea { top: -1px; } } -#tb_actionbar_item_redo.disabled, #tb_actionbar_item_undo.disabled, #tb_actionbar_item_mobile_wizard.disabled, #tb_actionbar_item_insertion_mobile_wizard.disabled { +#toolbar-up #redo.disabled, #toolbar-up #undo.disabled, #toolbar-up #mobile_wizard.disabled, #toolbar-up #insertion_mobile_wizard.disabled { display: none; } #toolbar-wrapper.mobile{ @@ -217,7 +217,7 @@ nav:not(.spreadsheet-color-indicator) ~ #toolbar-wrapper #toolbar-up.w2ui-toolba #toolbar-search { height: 39px !important; } -#tb_actionbar_item_fullscreen{display: none;} +#toolbar-up #fullscreen{display: none;} #toolbar-down { border-top: 1px solid var(--color-border) !important; } @@ -258,9 +258,6 @@ nav:not(.spreadsheet-color-indicator) ~ #toolbar-wrapper #toolbar-up.w2ui-toolba width: 36px !important; } -#tb_actionbar_item_userlist table{ - margin: -1px 0px auto 3px !important; -} #toolbar-up .checked{ border-color: transparent !important; background: none !important; diff --git a/browser/src/control/Control.JSDialogBuilder.js b/browser/src/control/Control.JSDialogBuilder.js index 9b8ffff849b5..4b05ed97a875 100644 --- a/browser/src/control/Control.JSDialogBuilder.js +++ b/browser/src/control/Control.JSDialogBuilder.js @@ -2755,7 +2755,7 @@ L.Control.JSDialogBuilder = L.Control.extend({ if (builder.wizard) { $(menuEntry).click(() => { if (window.insertionMobileWizard) - w2ui['actionbar'].click('insertion_mobile_wizard'); + app.dispatcher.dispatch('insertion_mobile_wizard'); else if (window.mobileMenuWizard) $('#main-menu-state').click(); else if (window.contextMenuWizard) { diff --git a/browser/src/control/Control.MobileTopBar.js b/browser/src/control/Control.MobileTopBar.js index bda179ae235f..45ec2fcf1837 100644 --- a/browser/src/control/Control.MobileTopBar.js +++ b/browser/src/control/Control.MobileTopBar.js @@ -12,7 +12,7 @@ * L.Control.SearchBar */ -/* global $ w2ui _UNO _ app */ +/* global $ _UNO _ app */ L.Control.MobileTopBar = L.Control.extend({ options: { @@ -25,6 +25,17 @@ L.Control.MobileTopBar = L.Control.extend({ onAdd: function (map) { this.map = map; + this.parentContainer = document.getElementById('toolbar-up'); + L.DomUtil.addClass(this.parentContainer, 'ui-toolbar'); + + this.builder = new L.control.jsDialogBuilder( + { + mobileWizard: this, + map: this.map, + cssClass: 'jsdialog', + noLabelsForUnoButtons: true + }); + this.create(); map.on('updatepermission', this.onUpdatePermission, this); @@ -32,196 +43,97 @@ L.Control.MobileTopBar = L.Control.extend({ }, getToolItems: function(docType) { + var isReadOnlyMode = app.map ? app.map.isReadOnlyMode() : true; + var canUserWrite = !app.isReadOnly(); + if (docType == 'text') { return [ - {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, - {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, + {type: 'toolitem', id: 'undo', text: _UNO('.uno:Undo'), command: '.uno:Undo', enabled: false}, + {type: 'toolitem', id: 'redo', text: _UNO('.uno:Redo'), command: '.uno:Redo', enabled: false}, {type: 'spacer', id: 'before-PermissionMode'}, - {type: 'html', id: 'PermissionMode', html:'
' + _('Read-only') + '
', hidden: true}, - {type: 'spacer', id: 'after-PermissionMode', hidden: true}, - {type: 'button', id: 'mobile_wizard', img: 'mobile_wizard', disabled: true}, - {type: 'button', id: 'insertion_mobile_wizard', img: 'insertion_mobile_wizard', disabled: true}, - {type: 'button', id: 'comment_wizard', img: 'viewcomments'}, - {type: 'drop', id: 'userlist', img: 'users', hidden: true, html: L.control.createUserListWidget()}, + { + type: 'container', + id: 'permissionmode-container', + children: [ + {type: 'htmlcontent', id: 'PermissionMode', htmlId: 'permissionmode', text: '     ', isReadOnlyMode: isReadOnlyMode, canUserWrite: canUserWrite, visible: false}, + {type: 'spacer', id: 'after-PermissionMode', visible: false}, + ], + vertical: false, + }, + {type: 'customtoolitem', id: 'mobile_wizard', command: 'mobile_wizard'}, + {type: 'customtoolitem', id: 'insertion_mobile_wizard', command: 'insertion_mobile_wizard'}, + {type: 'customtoolitem', id: 'comment_wizard', command: 'comment_wizard', w2icon: 'viewcomments'}, + {type: 'menubutton', id: 'userlist:UsersListMenu', visible: false}, ]; } else if (docType == 'spreadsheet') { return [ - {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, - {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, - {type: 'button', hidden: true, id: 'acceptformula', img: 'ok', hint: _('Accept')}, - {type: 'button', hidden: true, id: 'cancelformula', img: 'cancel', hint: _('Cancel')}, + {type: 'toolitem', id: 'undo', text: _UNO('.uno:Undo'), command: '.uno:Undo', enabled: false}, + {type: 'toolitem', id: 'redo', text: _UNO('.uno:Redo'), command: '.uno:Redo', enabled: false}, + {type: 'customtoolitem', visible: false, id: 'acceptformula', command: 'acceptformula', text: _('Accept')}, + {type: 'customtoolitem', visible: false, id: 'cancelformula', command: 'cancelformula', text: _('Cancel')}, {type: 'spacer'}, - {type: 'button', id: 'mobile_wizard', img: 'mobile_wizard', disabled: true}, - {type: 'button', id: 'insertion_mobile_wizard', img: 'insertion_mobile_wizard', disabled: true}, - {type: 'button', id: 'comment_wizard', img: 'viewcomments'}, - {type: 'drop', id: 'userlist', img: 'users', hidden: true, html: L.control.createUserListWidget()}, + {type: 'customtoolitem', id: 'mobile_wizard', command: 'mobile_wizard'}, + {type: 'customtoolitem', id: 'insertion_mobile_wizard', command: 'insertion_mobile_wizard'}, + {type: 'customtoolitem', id: 'comment_wizard', command: 'comment_wizard', w2icon: 'viewcomments'}, + {type: 'menubutton', id: 'userlist:UsersListMenu', visible: false}, ]; } else if (docType == 'presentation') { return [ - {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, - {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, + {type: 'toolitem', id: 'undo', text: _UNO('.uno:Undo'), command: '.uno:Undo', enabled: false}, + {type: 'toolitem', id: 'redo', text: _UNO('.uno:Redo'), command: '.uno:Redo', enabled: false}, {type: 'spacer'}, - {type: 'button', id: 'mobile_wizard', img: 'mobile_wizard', disabled: true}, - {type: 'button', id: 'insertion_mobile_wizard', img: 'insertion_mobile_wizard', disabled: true}, - {type: 'button', id: 'comment_wizard', img: 'viewcomments'}, - {type: 'button', id: 'fullscreen-' + docType, img: 'fullscreen-presentation', hint: _UNO('.uno:FullScreen', docType)}, - {type: 'drop', id: 'userlist', img: 'users', hidden: true, html: L.control.createUserListWidget()}, + {type: 'customtoolitem', id: 'mobile_wizard', command: 'mobile_wizard'}, + {type: 'customtoolitem', id: 'insertion_mobile_wizard', command: 'insertion_mobile_wizard'}, + {type: 'customtoolitem', id: 'comment_wizard', command: 'comment_wizard', w2icon: 'viewcomments'}, + {type: 'customtoolitem', id: 'fullscreen-' + docType, text: _UNO('.uno:FullScreen', docType)}, + {type: 'menubutton', id: 'userlist:UsersListMenu', visible: false}, ]; } else if (docType == 'drawing') { return [ - {type: 'button', id: 'undo', img: 'undo', hint: _UNO('.uno:Undo'), uno: 'Undo', disabled: true}, - {type: 'button', id: 'redo', img: 'redo', hint: _UNO('.uno:Redo'), uno: 'Redo', disabled: true}, + {type: 'toolitem', id: 'undo', text: _UNO('.uno:Undo'), command: '.uno:Undo', enabled: false}, + {type: 'toolitem', id: 'redo', text: _UNO('.uno:Redo'), command: '.uno:Redo', enabled: false}, {type: 'spacer'}, - {type: 'button', id: 'mobile_wizard', img: 'mobile_wizard', disabled: true}, - {type: 'button', id: 'insertion_mobile_wizard', img: 'insertion_mobile_wizard', disabled: true}, - {type: 'button', id: 'comment_wizard', img: 'viewcomments'}, - {type: 'drop', id: 'userlist', img: 'users', hidden: true, html: L.control.createUserListWidget()}, + {type: 'customtoolitem', id: 'mobile_wizard', command: 'mobile_wizard'}, + {type: 'customtoolitem', id: 'insertion_mobile_wizard', command: 'insertion_mobile_wizard'}, + {type: 'customtoolitem', id: 'comment_wizard', command: 'comment_wizard', w2icon: 'viewcomments'}, + {type: 'menubutton', id: 'userlist:UsersListMenu', visible: false}, ]; } }, create: function() { - var toolItems = this.getToolItems(this.options.docType); - var that = this; - - var toolbar = $('#toolbar-up'); - toolbar.w2toolbar({ - name: 'actionbar', - items: toolItems, - onClick: function (e) { - that.onClick(e, e.target); - window.hideTooltip(this, e.target); - } - }); - - this.map.uiManager.enableTooltip(toolbar); + var items = this.getToolItems(this.options.docType); + this.builder.build(this.parentContainer, items); + }, - toolbar.bind('touchstart', function(e) { - w2ui['actionbar'].touchStarted = true; - var touchEvent = e.originalEvent; - if (touchEvent && touchEvent.touches.length > 1) { - L.DomEvent.preventDefault(e); - } + showItem(command, show) { + this.builder.executeAction(this.parentContainer, { + 'control_id': command, + 'action_type': show ? 'show' : 'hide' }); }, - onClick: function(e, id, item) { - if ('actionbar' in w2ui && w2ui['actionbar'].get(id) !== null) { - var toolbar = w2ui['actionbar']; - item = toolbar.get(id); - } - - this.map.preventKeyboardPopup(id); - - if (item.disabled) - return; - - if (item.uno) { - this.map.executeUnoAction(item); - } - else if (id === 'cancelformula') { - app.dispatcher.dispatch('cancelformula'); - } - else if (id === 'acceptformula') { - app.dispatcher.dispatch('acceptformula'); - } - else if (id === 'comment_wizard') { - if (window.commentWizard) { - window.commentWizard = false; - app.sectionContainer.getSectionWithName(L.CSections.CommentList.name).removeHighlighters(); - this.map.fire('closemobilewizard'); - toolbar.uncheck(id); - } - else { - if (window.insertionMobileWizard) - this.onClick(null, 'insertion_mobile_wizard'); - else if (window.mobileWizard) - this.onClick(null, 'mobile_wizard'); - window.commentWizard = true; - var menuData =this.map._docLayer.getCommentWizardStructure(); - this.map.fire('mobilewizard', {data: menuData}); - toolbar.check(id); - } - } - else if (id === 'fullscreen-drawing') { - if (item.checked) { - toolbar.uncheck(id); - } - else { - toolbar.check(id); - } - L.toggleFullScreen(); - } - else if (id === 'fullscreen-presentation') { - // Call global onClick handler - window.onClick(e, id, item); - } - else if (id === 'mobile_wizard') { - if (window.mobileWizard) { - window.mobileWizard = false; - this.map.sendUnoCommand('.uno:SidebarHide'); - this.map.fire('closemobilewizard'); - toolbar.uncheck(id); - } - else { - if (window.insertionMobileWizard) - this.onClick(null, 'insertion_mobile_wizard'); - else if (window.commentWizard) - this.onClick(null, 'comment_wizard'); - window.mobileWizard = true; - this.map.sendUnoCommand('.uno:SidebarShow'); - this.map.fire('showwizardsidebar'); - toolbar.check(id); - } - } - else if (id === 'insertion_mobile_wizard') { - if (window.insertionMobileWizard) { - window.insertionMobileWizard = false; - this.map.fire('closemobilewizard'); - toolbar.uncheck(id); - } - else { - if (window.mobileWizard) - this.onClick(null, 'mobile_wizard'); - else if (window.commentWizard) - this.onClick(null, 'comment_wizard'); - window.insertionMobileWizard = true; - menuData = this.map.menubar.generateInsertMenuStructure(); - this.map.fire('mobilewizard', {data: menuData}); - toolbar.check(id); - } - } - else if (id === 'userlist') { - this.map.fire('openuserlist'); - } + enableItem(command, enable) { + this.builder.executeAction(this.parentContainer, { + 'control_id': command, + 'action_type': enable ? 'enable' : 'disable' + }); }, onUpdatePermission: function(e) { - var toolbar; - var toolbarDownButtons = ['next', 'prev', 'mobile_wizard', 'insertion_mobile_wizard', 'comment_wizard']; + var toolbarButtons = ['next', 'prev', 'mobile_wizard', 'insertion_mobile_wizard', 'comment_wizard']; if (e.perm === 'edit') { - toolbar = w2ui['actionbar']; - if (toolbar) { - toolbarDownButtons.forEach(function(id) { - toolbar.enable(id); - }); - toolbar.hide('PermissionMode'); - toolbar.hide('after-PermissionMode'); - $('#tb_actionbar_item_before-PermissionMode').width(''); - } + toolbarButtons.forEach((id) => { + this.enableItem(id, true); + }); + this.showItem('PermissionMode', false); } else { - toolbar = w2ui['actionbar']; - if (toolbar) { - toolbarDownButtons.forEach(function(id) { - toolbar.disable(id); - }); - toolbar.enable('comment_wizard'); - if ($('#mobile-edit-button').is(':hidden')) { - toolbar.show('PermissionMode'); - toolbar.show('after-PermissionMode'); - $('#tb_actionbar_item_before-PermissionMode').width('50%'); - $('#tb_actionbar_item_after-PermissionMode').width('50%'); - } + toolbarButtons.forEach((id) => { + this.enableItem(id, false); + }); + this.enableItem('comment_wizard', true); + if ($('#mobile-edit-button').is(':hidden')) { + this.showItem('PermissionMode', true); } } }, @@ -232,13 +144,12 @@ L.Control.MobileTopBar = L.Control.extend({ if (this.map.isEditMode() && (state === 'enabled' || state === 'disabled')) { var id = window.unoCmdToToolbarId(commandName); - var toolbar = w2ui['actionbar']; if (state === 'enabled') { - toolbar.enable(id); + this.enableItem(id, true); } else { - toolbar.uncheck(id); - toolbar.disable(id); + //this.uncheck(id); + this.enableItem(id, false); } } }, diff --git a/browser/src/control/Control.MobileWizard.js b/browser/src/control/Control.MobileWizard.js index 8ea6e782370e..4683fb32d4b9 100644 --- a/browser/src/control/Control.MobileWizard.js +++ b/browser/src/control/Control.MobileWizard.js @@ -13,7 +13,7 @@ * L.Control.MobileWizard - main container can contain few MobileWizardWindows */ -/* global app $ w2ui */ +/* global app $ */ L.Control.MobileWizard = L.Control.extend({ initialize: function (options) { @@ -132,16 +132,16 @@ L.Control.MobileWizard = L.Control.extend({ }, _updateToolbarItemStateByClose: function() { - var toolbar = w2ui['actionbar']; + var toolbar = app.map.mobileTopBar; if (toolbar) { - if (window.mobileWizard === false && toolbar.get('mobile_wizard').checked) - toolbar.uncheck('mobile_wizard'); + //if (window.mobileWizard === false && toolbar.get('mobile_wizard').checked) + // toolbar.uncheck('mobile_wizard'); - if (window.insertionMobileWizard === false && toolbar.get('insertion_mobile_wizard').checked) - toolbar.uncheck('insertion_mobile_wizard'); - if (window.commentWizard === false && toolbar.get('comment_wizard').checked) - toolbar.uncheck('comment_wizard'); + //if (window.insertionMobileWizard === false && toolbar.get('insertion_mobile_wizard').checked) + // toolbar.uncheck('insertion_mobile_wizard'); + //if (window.commentWizard === false && toolbar.get('comment_wizard').checked) + // toolbar.uncheck('comment_wizard'); } }, diff --git a/browser/src/control/Control.MobileWizardWindow.js b/browser/src/control/Control.MobileWizardWindow.js index ce9b865cfe05..4544b73495fd 100644 --- a/browser/src/control/Control.MobileWizardWindow.js +++ b/browser/src/control/Control.MobileWizardWindow.js @@ -13,7 +13,7 @@ * L.Control.MobileWizardWindow - contains one unique window instance inside mobile-wizard */ -/* global app $ w2ui */ +/* global app $ */ L.Control.MobileWizardWindow = L.Control.extend({ options: { maxHeight: '45vh', @@ -277,13 +277,13 @@ L.Control.MobileWizardWindow = L.Control.extend({ this.parent.removeWindow(this); this._currentDepth = 0; if (window.mobileWizard === true) { - w2ui['actionbar'].click('mobile_wizard'); + app.dispatcher.dispatch('mobile_wizard'); } else if (window.insertionMobileWizard === true) { - w2ui['actionbar'].click('insertion_mobile_wizard'); + app.dispatcher.dispatch('insertion_mobile_wizard'); } else if (window.mobileMenuWizard === true) { $('#main-menu-state').click(); } else if (window.commentWizard === true) { - w2ui['actionbar'].click('comment_wizard'); + app.dispatcher.dispatch('comment_wizard'); } else if (window.contextMenuWizard) { window.contextMenuWizard = false; this.map.fire('closemobilewizard'); diff --git a/browser/src/control/Control.PartsPreview.js b/browser/src/control/Control.PartsPreview.js index da80987a548e..4c0d169699b4 100644 --- a/browser/src/control/Control.PartsPreview.js +++ b/browser/src/control/Control.PartsPreview.js @@ -12,7 +12,7 @@ * L.Control.PartsPreview */ -/* global _ app $ Hammer w2ui _UNO cool */ +/* global _ app $ Hammer _UNO cool */ L.Control.PartsPreview = L.Control.extend({ options: { fetchThumbnail: true, @@ -209,7 +209,7 @@ L.Control.PartsPreview = L.Control.extend({ // Remove selection to get the slide properties in mobile wizard. app.socket.sendMessage('resetselection'); setTimeout(function () { - w2ui['actionbar'].click('mobile_wizard'); + app.dispatcher.dispatch('mobile_wizard'); }, 0); } } else { diff --git a/browser/src/control/Control.UIManager.js b/browser/src/control/Control.UIManager.js index 491c44d12f08..be9f3ea280b2 100644 --- a/browser/src/control/Control.UIManager.js +++ b/browser/src/control/Control.UIManager.js @@ -295,7 +295,8 @@ L.Control.UIManager = L.Control.extend({ if (window.mode.isMobile()) { $('#mobile-edit-button').show(); this.map.addControl(L.control.mobileBottomBar(docType)); - this.map.addControl(L.control.mobileTopBar(docType)); + this.map.mobileTopBar = L.control.mobileTopBar(docType); + this.map.addControl(this.map.mobileTopBar); this.map.addControl(L.control.searchBar()); } else if (enableNotebookbar) { this.createNotebookbarControl(docType); diff --git a/browser/src/control/Control.UserList.ts b/browser/src/control/Control.UserList.ts index cbf3398aaa26..95a1ed8eea75 100644 --- a/browser/src/control/Control.UserList.ts +++ b/browser/src/control/Control.UserList.ts @@ -70,7 +70,6 @@ class UserList extends L.Control { map.on('addview', this.onAddView, this); map.on('removeview', this.onRemoveView, this); map.on('deselectuser', this.deselectUser, this); - map.on('openuserlist', this.onOpenUserList, this); if (window.mode.isMobile() || window.mode.isTablet()) { this.options.nUsers = '%n'; @@ -378,19 +377,17 @@ class UserList extends L.Control { this.map.statusBar.setUsersCountText(text); if (!this.hideUserList() && count > 1) { - if (window.mode.isDesktop()) { + if (this.map.statusBar) { this.map.statusBar.showItem('userlist', true); this.map.statusBar.showItem('userlistbreak', true); - } else { - var toolbar = w2ui['actionbar']; - toolbar.show('userlist'); } - } else if (window.mode.isDesktop()) { + if (this.map.mobileTopBar) + this.map.mobileTopBar.showItem('userlist', true); + } else if (this.map.statusBar) { this.map.statusBar.showItem('userlist', false); this.map.statusBar.showItem('userlistbreak', false); - } else { - var toolbar = w2ui['actionbar']; - toolbar.hide('userlist'); + } else if (this.map.mobileTopBar) { + this.map.mobileTopBar.showItem('userlist', false); } } @@ -405,13 +402,6 @@ class UserList extends L.Control { this.renderAll(); } - onOpenUserList() { - // TODO: used on mobile, remove w2ui and it will be not needed - setTimeout(() => { - this.renderAll(); - }, 100); - } - onAddView(e: UserEvent) { let color; let username; @@ -460,14 +450,11 @@ class UserList extends L.Control { renderAll() { this.updateUserListCount(); this.renderHeaderAvatars(); - const jsdialogPopoverElement = document.getElementById('userlist-entries'); - if (jsdialogPopoverElement) - this.renderHeaderAvatarPopover(jsdialogPopoverElement); - const mobilePopoverElement = document.getElementById( - 'w2ui-overlay-actionbar', - ); - if (mobilePopoverElement) - this.renderHeaderAvatarPopover(mobilePopoverElement); + const topPopoverElement = document.getElementById('userListPopover'); + if (topPopoverElement) this.renderHeaderAvatarPopover(topPopoverElement); + const statusbarPopoverElement = document.getElementById('userlist-entries'); + if (statusbarPopoverElement) + this.renderHeaderAvatarPopover(statusbarPopoverElement); this.renderFollowingChip(); } diff --git a/browser/src/control/Toolbar.js b/browser/src/control/Toolbar.js index 0a57b5d25137..6b49a5102fd6 100644 --- a/browser/src/control/Toolbar.js +++ b/browser/src/control/Toolbar.js @@ -1064,20 +1064,19 @@ L.Map.include({ }, onFormulaBarFocus: function() { - var mobileTopBar = w2ui['actionbar']; - var jsdialogFormulabar = this.formulabar; - var target = jsdialogFormulabar; - if (window.mode.isMobile() === true) { - mobileTopBar.hide('undo'); - mobileTopBar.hide('redo'); - target = mobileTopBar; + var mobileTopBar = this.mobileTopBar; + mobileTopBar.showItem('undo', false); + mobileTopBar.showItem('redo', false); + mobileTopBar.showItem('cancelformula', true); + mobileTopBar.showItem('acceptformula', true); } else { + var jsdialogFormulabar = this.formulabar; jsdialogFormulabar.hide('startformula'); jsdialogFormulabar.hide('AutoSumMenu'); + jsdialogFormulabar.show('cancelformula'); + jsdialogFormulabar.show('acceptformula'); } - target.show('cancelformula'); - target.show('acceptformula'); }, onFormulaBarBlur: function() { @@ -1087,27 +1086,27 @@ L.Map.include({ // TODO: Some better way to do it ? var map = this; - setTimeout(function() { + setTimeout(() => { if ($('.leaflet-cursor').is(':visible')) return; - var mobileTopBar = window.mode.isMobile() ? w2ui['actionbar'] : null; - var jsdialogFormulabar = map.formulabar; - - var target = window.mode.isMobile() ? mobileTopBar : jsdialogFormulabar; - target.hide('cancelformula'); - target.hide('acceptformula'); - if (mobileTopBar) { - mobileTopBar.show('undo'); - mobileTopBar.show('redo'); + if (window.mode.isMobile()) { + var mobileTopBar = map.mobileTopBar; + mobileTopBar.showItem('cancelformula', false); + mobileTopBar.showItem('acceptformula', false); + mobileTopBar.showItem('undo', true); + mobileTopBar.showItem('redo', true); + } else { + var jsdialogFormulabar = map.formulabar; + jsdialogFormulabar.hide('cancelformula'); + jsdialogFormulabar.hide('acceptformula'); + jsdialogFormulabar.show('startformula'); + jsdialogFormulabar.show('AutoSumMenu'); } $('#AutoSumMenu-button').css('margin-inline', '0'); $('#AutoSumMenu .unoarrow').css('margin', '0'); - jsdialogFormulabar.show('startformula'); - jsdialogFormulabar.show('AutoSumMenu'); - // clear reference marks map._docLayer._clearReferences(); }, 250); diff --git a/browser/src/docdispatcher.ts b/browser/src/docdispatcher.ts index 05cfe2992f5a..4f583660417d 100644 --- a/browser/src/docdispatcher.ts +++ b/browser/src/docdispatcher.ts @@ -76,6 +76,62 @@ class Dispatcher { app.map.uiManager.enterReadonlyOrClose(); }; + this.actionsMap['comment_wizard'] = function () { + const configuration = window as any; + if (configuration.commentWizard) { + configuration.commentWizard = false; + app.sectionContainer + .getSectionWithName(L.CSections.CommentList.name) + .removeHighlighters(); + app.map.fire('closemobilewizard'); + //app.map.mobileTopBar.uncheck(id); + } else { + if (configuration.insertionMobileWizard) + app.dispatcher.dispatch('insertion_mobile_wizard'); + else if (configuration.mobileWizard) + app.dispatcher.dispatch('mobile_wizard'); + configuration.commentWizard = true; + var menuData = app.map._docLayer.getCommentWizardStructure(); + app.map.fire('mobilewizard', { data: menuData }); + //app.map.mobileTopBar.check(id); + } + }; + this.actionsMap['mobile_wizard'] = () => { + const configuration = window as any; + if (configuration.mobileWizard) { + configuration.mobileWizard = false; + app.map.sendUnoCommand('.uno:SidebarHide'); + app.map.fire('closemobilewizard'); + //app.map.mobileTopBar.uncheck(id); + } else { + if (configuration.insertionMobileWizard) + app.dispatcher.dispatch('insertion_mobile_wizard'); + else if (configuration.commentWizard) + app.dispatcher.dispatch('comment_wizard'); + configuration.mobileWizard = true; + app.map.sendUnoCommand('.uno:SidebarShow'); + app.map.fire('showwizardsidebar'); + //app.map.mobileTopBar.check(id); + } + }; + this.actionsMap['insertion_mobile_wizard'] = () => { + const configuration = window as any; + if (configuration.insertionMobileWizard) { + configuration.insertionMobileWizard = false; + app.map.fire('closemobilewizard'); + //app.map.mobileTopBar.uncheck(id); + } else { + if (configuration.mobileWizard) + app.dispatcher.dispatch('mobile_wizard'); + else if (configuration.commentWizard) + app.dispatcher.dispatch('comment_wizard'); + configuration.insertionMobileWizard = true; + const menuData = app.map.menubar.generateInsertMenuStructure(); + app.map.fire('mobilewizard', { data: menuData }); + //app.map.mobileTopBar.check(id); + } + }; + this.actionsMap['toggledarktheme'] = function () { app.map.uiManager.toggleDarkMode(); }; @@ -312,6 +368,12 @@ class Dispatcher { this.actionsMap['presentation'] = function () { app.map.fire('fullscreen'); }; + this.actionsMap['fullscreen-drawing'] = () => { + L.toggleFullScreen(); + }; + this.actionsMap['fullscreen-presentation'] = () => { + app.map.fire('fullscreen'); + }; this.actionsMap['presentinwindow'] = function () { app.map.fire('presentinwindow'); }; diff --git a/cypress_test/integration_tests/common/calc_helper.js b/cypress_test/integration_tests/common/calc_helper.js index ba1afbb13ada..54680b2be015 100644 --- a/cypress_test/integration_tests/common/calc_helper.js +++ b/cypress_test/integration_tests/common/calc_helper.js @@ -92,8 +92,8 @@ function typeIntoFormulabar(text) { cy.cGet('#sc_input_window.formulabar').should('have.class', 'focused'); helper.doIfOnMobile(function() { - cy.cGet('#tb_actionbar_item_acceptformula').should('be.visible'); - cy.cGet('#tb_actionbar_item_cancelformula').should('be.visible'); + cy.cGet('#toolbar-up #acceptformula').should('be.visible'); + cy.cGet('#toolbar-up #cancelformula').should('be.visible'); }); helper.doIfOnDesktop(function() { cy.cGet('#acceptformula').should('be.visible'); diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 22ee558b73eb..089e517c08d2 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -278,7 +278,7 @@ function upLoadFileToNextCloud(fileName, subFolder, subsequentLoad) { function waitForInterferingUser() { cy.log('>> waitForInterferingUser - start'); - cy.cGet('#tb_actionbar_item_userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) + cy.cGet('#toolbar-up #userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) .should('be.visible'); cy.wait(10000); diff --git a/cypress_test/integration_tests/common/impress_helper.js b/cypress_test/integration_tests/common/impress_helper.js index ccbc04f41b7e..589429da8288 100644 --- a/cypress_test/integration_tests/common/impress_helper.js +++ b/cypress_test/integration_tests/common/impress_helper.js @@ -225,9 +225,9 @@ function changeSlide(changeNum,direction) { var slideButton; if (direction === 'next') { - slideButton = cy.cGet('#tb_actionbar_item_next'); + slideButton = cy.cGet('#toolbar-up #next'); } else if (direction === 'previous') { - slideButton = cy.cGet('#tb_actionbar_item_prev'); + slideButton = cy.cGet('#toolbar-up #prev'); } if (slideButton) { for (var n = 0; n < changeNum; n++) { diff --git a/cypress_test/integration_tests/common/interference_user_spec.js b/cypress_test/integration_tests/common/interference_user_spec.js index 8bfa2200cf3c..f3c6f8710259 100644 --- a/cypress_test/integration_tests/common/interference_user_spec.js +++ b/cypress_test/integration_tests/common/interference_user_spec.js @@ -34,7 +34,7 @@ describe('Interfering second user.', function() { helper.beforeAll(text, getComponent(text), true); }); - cy.get('#tb_actionbar_item_userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) + cy.get('#toolbar-up #userlist', { timeout: Cypress.config('defaultCommandTimeout') * 2.0 }) .should('be.visible'); helper.doIfOnMobile(function() { @@ -61,7 +61,7 @@ describe('Interfering second user.', function() { } }); - return cy.get('#tb_actionbar_item_userlist') + return cy.get('#toolbar-up #userlist') .then(function(userlist) { return !Cypress.dom.isVisible(userlist[0]); }); diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js index ede5eaa0d490..7727cdb7ed24 100644 --- a/cypress_test/integration_tests/common/mobile_helper.js +++ b/cypress_test/integration_tests/common/mobile_helper.js @@ -104,17 +104,17 @@ function closeHamburgerMenu() { function openMobileWizard() { cy.log('>> openMobileWizard - start'); - helper.waitUntilIdle('#tb_actionbar_item_mobile_wizard'); + helper.waitUntilIdle('#toolbar-up #mobile_wizard'); // Open mobile wizard - cy.cGet('#tb_actionbar_item_mobile_wizard') + cy.cGet('#toolbar-up #mobile_wizard') .should('not.have.class', 'disabled') .click(); // Mobile wizard is opened and it has content cy.cGet('#mobile-wizard-content') .should('not.be.empty'); - cy.cGet('#tb_actionbar_item_mobile_wizard table') - .should('have.class', 'checked'); + //cy.cGet('#toolbar-up #mobile_wizard') + // .should('have.class', 'checked'); cy.log('<< openMobileWizard - end'); } @@ -122,16 +122,16 @@ function openMobileWizard() { function closeMobileWizard() { cy.log('>> closeMobileWizard - start'); - cy.cGet('#tb_actionbar_item_mobile_wizard table') - .should('have.class', 'checked'); + //cy.cGet('#toolbar-up #mobile_wizard') + // .should('have.class', 'checked'); - cy.cGet('#tb_actionbar_item_mobile_wizard') + cy.cGet('#toolbar-up #mobile_wizard') .click(); cy.cGet('#mobile-wizard') .should('not.be.visible'); - cy.cGet('#tb_actionbar_item_mobile_wizard table') - .should('not.have.class', 'checked'); + //cy.cGet('#toolbar-up #mobile_wizard') + // .should('not.have.class', 'checked'); cy.log('<< closeMobileWizard - end'); } @@ -161,15 +161,15 @@ function executeCopyFromContextMenu(XPos, YPos) { function openInsertionWizard() { cy.log('>> openInsertionWizard - start'); - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard') + cy.cGet('#toolbar-up #insertion_mobile_wizard') .should('not.have.class', 'disabled') .click(); cy.cGet('#mobile-wizard-content') .should('not.be.empty'); - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard table') - .should('have.class', 'checked'); + //cy.cGet('#toolbar-up #insertion_mobile_wizard') + // .should('have.class', 'checked'); cy.log('<< openInsertionWizard - end'); } @@ -177,12 +177,12 @@ function openInsertionWizard() { function openCommentWizard() { cy.log('>> openCommentWizard - start'); - cy.cGet('#tb_actionbar_item_comment_wizard') + cy.cGet('#toolbar-up #comment_wizard') .should('not.have.class', 'disabled') .click(); - cy.cGet('#tb_actionbar_item_comment_wizard table') - .should('have.class', 'checked'); + //cy.cGet('#toolbar-up #comment_wizard') + // .should('have.class', 'checked'); cy.log('<< openCommentWizard - end'); } @@ -190,17 +190,17 @@ function openCommentWizard() { function closeInsertionWizard() { cy.log('>> closeInsertionWizard - start'); - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard table') - .should('have.class', 'checked'); + //cy.cGet('#toolbar-up #insertion_mobile_wizard') + // .should('have.class', 'checked'); - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard') + cy.cGet('#toolbar-up #insertion_mobile_wizard') .click(); cy.cGet('#mobile-wizard') .should('not.be.visible'); - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard table') - .should('not.have.class', 'checked'); + //cy.cGet('#toolbar-up #insertion_mobile_wizard') + // .should('not.have.class', 'checked'); cy.log('<< closeInsertionWizard - end'); } diff --git a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js index ea878bb39471..604a051edfa6 100644 --- a/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js +++ b/cypress_test/integration_tests/mobile/calc/alignment_options_spec.js @@ -25,7 +25,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Change alignment setti helper.getCursorPos('left', 'currentTextEndPos'); //remove text selection - cy.cGet('#tb_actionbar_item_acceptformula').should('be.visible') + cy.cGet('#toolbar-up #acceptformula').should('be.visible') .then($ele =>{ if (Cypress.dom.isVisible($ele)) { cy.wrap($ele).click(); diff --git a/cypress_test/integration_tests/mobile/calc/annotation_spec.js b/cypress_test/integration_tests/mobile/calc/annotation_spec.js index 41d4771b1541..f044826cc741 100644 --- a/cypress_test/integration_tests/mobile/calc/annotation_spec.js +++ b/cypress_test/integration_tests/mobile/calc/annotation_spec.js @@ -38,7 +38,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Annotation Tests',function( cy.cGet('#annotation-content-area-1').should('have.text', 'some text'); cy.cGet('#input-modal-input').type('modified'); cy.cGet('#response-ok').click(); - cy.cGet('#tb_actionbar_item_comment_wizard').click(); + cy.cGet('#toolbar-up #comment_wizard').click(); cy.cGet('#comment-container-1').should('exist'); cy.cGet('#annotation-content-area-1').should('have.text', 'some textmodified'); }); diff --git a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js index 80d6077ab9ed..027c7832c2ac 100644 --- a/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/calc/bottom_toolbar_spec.js @@ -27,7 +27,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Interact with bottom toolba helper.getCursorPos('left', 'currentTextEndPos'); - cy.cGet('#tb_actionbar_item_acceptformula').should('be.visible') + cy.cGet('#toolbar-up #acceptformula').should('be.visible') .then($ele =>{ if (Cypress.dom.isVisible($ele)) { cy.wrap($ele).click(); diff --git a/cypress_test/integration_tests/mobile/calc/focus_spec.js b/cypress_test/integration_tests/mobile/calc/focus_spec.js index a0cd63ea5e80..754fb14d68d0 100644 --- a/cypress_test/integration_tests/mobile/calc/focus_spec.js +++ b/cypress_test/integration_tests/mobile/calc/focus_spec.js @@ -87,7 +87,7 @@ describe.skip(['tagmobile'], 'Calc focus tests', function() { // Type some text. var text1 = 'Hello from Calc'; calcHelper.typeIntoFormulabar(text1); - cy.cGet('#tb_actionbar_item_acceptformula') + cy.cGet('#toolbar-up #acceptformula') .click(); helper.assertNoKeyboardInput(); @@ -101,7 +101,7 @@ describe.skip(['tagmobile'], 'Calc focus tests', function() { helper.expectTextForClipboard(text1); // Accept changes. - cy.cGet('#tb_actionbar_item_acceptformula') + cy.cGet('#toolbar-up #acceptformula') .click(); helper.assertNoKeyboardInput(); @@ -116,7 +116,7 @@ describe.skip(['tagmobile'], 'Calc focus tests', function() { calcHelper.typeIntoFormulabar('{ctrl}a'); helper.expectTextForClipboard(text1 + text2); // End editing. - cy.cGet('#tb_actionbar_item_acceptformula') + cy.cGet('#toolbar-up #acceptformula') .click(); helper.assertNoKeyboardInput(); }); diff --git a/cypress_test/integration_tests/mobile/calc/formulabar_spec.js b/cypress_test/integration_tests/mobile/calc/formulabar_spec.js index b4fd86e9a727..7807973c87ad 100644 --- a/cypress_test/integration_tests/mobile/calc/formulabar_spec.js +++ b/cypress_test/integration_tests/mobile/calc/formulabar_spec.js @@ -114,7 +114,7 @@ describe(['tagmobile', 'tagnextcloud'], 'Formula bar tests.', function() { calcHelper.typeIntoFormulabar('{backspace}{backspace}{backspace}'); - cy.cGet('#tb_actionbar_item_acceptformula') + cy.cGet('#toolbar-up #acceptformula') .click(); calcHelper.selectEntireSheet(); @@ -137,7 +137,7 @@ describe(['tagmobile', 'tagnextcloud'], 'Formula bar tests.', function() { calcHelper.typeIntoFormulabar('{end}{backspace}{backspace}{backspace}'); - cy.cGet('#tb_actionbar_item_cancelformula') + cy.cGet('#toolbar-up #cancelformula') .click(); cy.wait(2000); diff --git a/cypress_test/integration_tests/mobile/calc/undo_redo_spec.js b/cypress_test/integration_tests/mobile/calc/undo_redo_spec.js index 1e6b1cb97f67..3291ee93fee5 100644 --- a/cypress_test/integration_tests/mobile/calc/undo_redo_spec.js +++ b/cypress_test/integration_tests/mobile/calc/undo_redo_spec.js @@ -26,12 +26,12 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f helper.typeIntoDocument('Hello World'); - cy.cGet('#tb_actionbar_item_acceptformula').click(); + cy.cGet('#toolbar-up #acceptformula').click(); //if we don't wait tests in CLI is failing cy.wait(3000); - cy.cGet('#tb_actionbar_item_undo').click(); + cy.cGet('#toolbar-up #undo').click(); calcHelper.dblClickOnFirstCell(); @@ -39,7 +39,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f helper.textSelectionShouldNotExist(); - cy.cGet('#tb_actionbar_item_acceptformula').click(); + cy.cGet('#toolbar-up #acceptformula').click(); } it('Undo', function() { @@ -51,7 +51,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f cy.wait(3000); - cy.cGet('#tb_actionbar_item_redo').click(); + cy.cGet('#toolbar-up #redo').click(); calcHelper.dblClickOnFirstCell(); @@ -67,7 +67,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f cy.wait(3000); - cy.cGet('#tb_actionbar_item_acceptformula').click(); + cy.cGet('#toolbar-up #acceptformula').click(); calcHelper.dblClickOnFirstCell(); @@ -77,7 +77,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f cy.wait(3000); - cy.cGet('#tb_actionbar_item_acceptformula').click(); + cy.cGet('#toolbar-up #acceptformula').click(); repairHelper.rollbackPastChange('Undo', undefined, true); diff --git a/cypress_test/integration_tests/mobile/impress/annotation_spec.js b/cypress_test/integration_tests/mobile/impress/annotation_spec.js index e6129eb15945..4dfe312e5a8f 100644 --- a/cypress_test/integration_tests/mobile/impress/annotation_spec.js +++ b/cypress_test/integration_tests/mobile/impress/annotation_spec.js @@ -41,7 +41,7 @@ describe(['tagmobile'], 'Annotation tests.', function() { cy.cGet('#annotation-content-area-1').should('have.text', 'some text'); cy.cGet('#input-modal-input').type('modified'); cy.cGet('#response-ok').click(); - cy.cGet('#tb_actionbar_item_comment_wizard').click(); + cy.cGet('#toolbar-up #comment_wizard').click(); cy.cGet('#annotation-content-area-1').should('exist'); cy.cGet('#annotation-content-area-1').should('have.text', 'some textmodified'); }); diff --git a/cypress_test/integration_tests/mobile/impress/undo_redo_spec.js b/cypress_test/integration_tests/mobile/impress/undo_redo_spec.js index 1451aeae7f96..83ad9a663951 100644 --- a/cypress_test/integration_tests/mobile/impress/undo_redo_spec.js +++ b/cypress_test/integration_tests/mobile/impress/undo_redo_spec.js @@ -34,7 +34,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f //if we don't wait tests in CLI is failing cy.wait(3000); - cy.cGet('#tb_actionbar_item_undo').click(); + cy.cGet('#toolbar-up #undo').click(); helper.selectAllText(); @@ -51,7 +51,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f it('Redo',function() { undo(); - cy.cGet('#tb_actionbar_item_redo').click(); + cy.cGet('#toolbar-up #redo').click(); helper.selectAllText(); diff --git a/cypress_test/integration_tests/mobile/writer/annotation_spec.js b/cypress_test/integration_tests/mobile/writer/annotation_spec.js index 425af8d6ff11..4e13654a53d2 100644 --- a/cypress_test/integration_tests/mobile/writer/annotation_spec.js +++ b/cypress_test/integration_tests/mobile/writer/annotation_spec.js @@ -40,7 +40,7 @@ describe(['tagmobile'], 'Annotation tests.', function() { //cy.get('.blinking-cursor').should('be.visible'); cy.cGet('#input-modal-input').type('{home}modified '); cy.cGet('#response-ok').click(); - cy.cGet('#tb_actionbar_item_comment_wizard').click(); + cy.cGet('#toolbar-up #comment_wizard').click(); cy.cGet('#comment-container-1').should('exist'); cy.cGet('#annotation-content-area-1').should('have.text', 'modified some text'); }); diff --git a/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js index 00f1ffdefbab..f6fd96feedaa 100644 --- a/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js +++ b/cypress_test/integration_tests/mobile/writer/mobile_wizard_state_spec.js @@ -47,16 +47,16 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Mobile wizard state tests', cy.cGet('body').contains('.ui-header.level-0.mobile-wizard.ui-widget .menu-entry-with-icon', 'Paste').should('be.visible'); // TODO: fix this bug - //cy.get('#tb_actionbar_item_mobile_wizard table') + //cy.get('#toolbar-up #mobile_wizard table') // .should('not.have.class', 'checked'); // Open mobile wizard again - cy.cGet('#tb_actionbar_item_mobile_wizard').click(); + cy.cGet('#toolbar-up #mobile_wizard').click(); // TODO: fix this bug //cy.get('#mobile-wizard-content') // .should('not.be.empty'); - //cy.get('#tb_actionbar_item_mobile_wizard table') + //cy.get('#toolbar-up #mobile_wizard table') // .should('have.class', 'checked'); }); }); diff --git a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js index 5c854ad82b05..c193f9d5c024 100644 --- a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js @@ -17,75 +17,75 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function() it('State of mobile wizard toolbar item.', function() { // Mobile wizard toolbar button is disabled by default - cy.cGet('#tb_actionbar_item_mobile_wizard').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now - cy.cGet('#tb_actionbar_item_mobile_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'disabled'); }); it('State of insertion mobile wizard toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #insertion_mobile_wizard').should('have.class', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now - cy.cGet('#tb_actionbar_item_insertion_mobile_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #insertion_mobile_wizard').should('not.have.class', 'disabled'); }); it('State of comment wizard toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#tb_actionbar_item_comment_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now - cy.cGet('#tb_actionbar_item_comment_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled'); }); it('State of undo toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#tb_actionbar_item_undo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('have.class', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be still disabled - cy.cGet('#tb_actionbar_item_undo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('have.class', 'disabled'); // Type something in the document helper.typeIntoDocument('x'); // Button should become enabled - cy.cGet('#tb_actionbar_item_undo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled'); }); it('State of redo toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#tb_actionbar_item_redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be still disabled - cy.cGet('#tb_actionbar_item_redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); // Type something in the document helper.typeIntoDocument('x'); // Button should be still disabled - cy.cGet('#tb_actionbar_item_redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); // Do an undo - cy.cGet('#tb_actionbar_item_undo').should('not.have.class', 'disabled'); - cy.cGet('#tb_actionbar_item_undo').click(); + cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').click(); // Button should become enabled - cy.cGet('#tb_actionbar_item_redo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('not.have.class', 'disabled'); }); it('Open and close mobile wizard by toolbar item.', function() { // Click on edit button mobileHelper.enableEditingMobile(); // Click on mobile wizard toolbar item - cy.cGet('#tb_actionbar_item_mobile_wizard').should('not.have.class', 'disabled').click(); + cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'disabled').click(); // Mobile wizard is opened and it has any content cy.cGet('#mobile-wizard-content').should('not.be.empty'); // Toolbar button is checked - cy.cGet('#tb_actionbar_item_mobile_wizard table').should('have.class', 'checked'); - cy.cGet('#tb_actionbar_item_mobile_wizard').click(); + //cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'checked'); + cy.cGet('#toolbar-up #mobile_wizard').click(); // Mobile wizard is closed cy.cGet('#mobile-wizard').should('not.be.visible'); - cy.cGet('#tb_actionbar_item_mobile_wizard table').should('not.have.class', 'checked'); + //cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'checked'); }); it('Open and close insertion mobile wizard by toolbar item.', function() { @@ -100,14 +100,14 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function() // Click on edit button mobileHelper.enableEditingMobile(); // Click on mobile wizard toolbar item - cy.cGet('#tb_actionbar_item_comment_wizard').should('not.have.class', 'disabled').click(); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled').click(); // Mobile wizard is opened and it has any content cy.cGet('#mobile-wizard-content').should('not.be.empty'); // Toolbar button is checked - cy.cGet('#tb_actionbar_item_comment_wizard table').should('have.class', 'checked'); - cy.cGet('#tb_actionbar_item_comment_wizard').click(); + //cy.cGet('#toolbar-up #comment_wizard').should('have.class', 'checked'); + cy.cGet('#toolbar-up #comment_wizard').click(); // Mobile wizard is closed cy.cGet('#mobile-wizard').should('not.be.visible'); - cy.cGet('#tb_actionbar_item_comment_wizard table').should('not.have.class', 'checked'); + //cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'checked'); }); }); diff --git a/cypress_test/integration_tests/mobile/writer/undo_redo_spec.js b/cypress_test/integration_tests/mobile/writer/undo_redo_spec.js index 13e56d4b7440..b9adf588e850 100644 --- a/cypress_test/integration_tests/mobile/writer/undo_redo_spec.js +++ b/cypress_test/integration_tests/mobile/writer/undo_redo_spec.js @@ -21,7 +21,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f helper.typeIntoDocument('Hello World'); //if we don't wait tests in CI is failing cy.wait(1000); - cy.cGet('#tb_actionbar_item_undo').click(); + cy.cGet('#toolbar-up #undo').click(); helper.selectAllText(); helper.expectTextForClipboard('Hello \n'); } @@ -32,7 +32,7 @@ describe.skip(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Editing Operations', f it('Redo',function() { undo(); - cy.cGet('#tb_actionbar_item_redo').click(); + cy.cGet('#toolbar-up #redo').click(); helper.selectAllText(); helper.expectTextForClipboard('Hello World'); }); From 4af7d734f461ef411429ccbaac5146433abfc879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Sun, 31 Mar 2024 22:42:43 +0200 Subject: [PATCH 3/5] remove-w2ui: stop using old toolbars on tablet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Szymon Kłos Change-Id: Id8fd8e67c80eab7f48d1c519ecddb3d8dfd16062 --- browser/src/control/Control.UIManager.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/browser/src/control/Control.UIManager.js b/browser/src/control/Control.UIManager.js index be9f3ea280b2..6019c7198f2d 100644 --- a/browser/src/control/Control.UIManager.js +++ b/browser/src/control/Control.UIManager.js @@ -54,8 +54,7 @@ L.Control.UIManager = L.Control.extend({ map.on('unblockUI', this.unblockUI, this); $('#toolbar-wrapper').on('click', function (event) { - if (event.target.parentElement.id === 'toolbar-up' || // checks if clicked on empty part of the toolbar on tabbed view - event.target.id === 'tb_editbar_item_item_64') // checks if clicked on empty part of the toolbar on compact view + if (event.target.parentElement.id === 'toolbar-up') // checks if clicked on empty part of the toolbar on tabbed view that.map.fire('editorgotfocus'); }); @@ -348,7 +347,7 @@ L.Control.UIManager = L.Control.extend({ JSDialog.PresentationBar(this.map); } - if (window.mode.isMobile() || (window.mode.isTablet() && !enableNotebookbar)) { + if (window.mode.isMobile()) { this.map.on('updatetoolbarcommandvalues', function() { w2ui['editbar'].refresh(); }); @@ -782,7 +781,7 @@ L.Control.UIManager = L.Control.extend({ var obj = $('.unfold'); obj.removeClass('w2ui-icon unfold'); obj.addClass('w2ui-icon fold'); - $('#tb_editbar_item_fold').prop('title', _('Hide Menu')); + $('#fold').prop('title', _('Hide Menu')); if (this._notebookbarShouldBeCollapsed) this.collapseNotebookbar(); @@ -805,7 +804,7 @@ L.Control.UIManager = L.Control.extend({ var obj = $('.fold'); obj.removeClass('w2ui-icon fold'); obj.addClass('w2ui-icon unfold'); - $('#tb_editbar_item_fold').prop('title', _('Show Menu')); + $('#fold').prop('title', _('Show Menu')); }, isMenubarHidden: function() { From ed19616bcf2d45b8541e717f4bebbf0a02da2656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 1 Apr 2024 08:42:29 +0200 Subject: [PATCH 4/5] cypress: make table_operation_spec.js more reliable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - it failed due to click on disabled button - make waiting for idle click be aware of that - add small waits after doing table changes to allow updates to be applied Signed-off-by: Szymon Kłos Change-Id: If19352923aeca4c18024f3a2ffcc3731a8aff96f --- cypress_test/integration_tests/common/helper.js | 2 ++ .../desktop/writer/table_operation_spec.js | 14 +++++++++++--- .../mobile/writer/table_properties_spec.js | 8 ++++++-- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js index 089e517c08d2..91ec502bc424 100644 --- a/cypress_test/integration_tests/common/helper.js +++ b/cypress_test/integration_tests/common/helper.js @@ -838,8 +838,10 @@ function clickOnIdle(selector, content) { // Then call .click() directly from the test cy.log('clickOnIdle stubbed'); if (content) { + cy.cGet(selector, content).should('not.have.attr', 'disabled'); cy.cGet(selector, content).click(); } else { + cy.cGet(selector).should('not.have.attr', 'disabled'); cy.cGet(selector).click(); } } diff --git a/cypress_test/integration_tests/desktop/writer/table_operation_spec.js b/cypress_test/integration_tests/desktop/writer/table_operation_spec.js index 0cdbd12f8028..026101c251aa 100644 --- a/cypress_test/integration_tests/desktop/writer/table_operation_spec.js +++ b/cypress_test/integration_tests/desktop/writer/table_operation_spec.js @@ -140,7 +140,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio // With merging two rows, the cursor is moved into the first row. cy.get('@origCursorPos') .then(function(origCursorPos) { - helper.clickOnIdle('#split_merge .unoMergeCells button'); + helper.clickOnIdle('#split_merge .unoMergeCells'); cy.cGet('.blinking-cursor') .should(function(cursor) { @@ -183,6 +183,8 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); + cy.wait(200); + helper.clickOnIdle('#rowsizing .unoSetOptimalRowHeight'); helper.clickOnIdle('#rowsizing .unoSetMinimalRowHeight'); selectFullTable(); @@ -196,7 +198,9 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); - helper.clickOnIdle('#rowsizing .unoSetOptimalRowHeight button'); + + cy.wait(200); + helper.clickOnIdle('#rowsizing .unoSetOptimalRowHeight'); selectFullTable(); // Check new row height @@ -218,7 +222,8 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); - helper.clickOnIdle('#rowsizing .unoDistributeRows button'); + cy.wait(200); + helper.clickOnIdle('#rowsizing .unoDistributeRows'); selectFullTable(); @@ -241,6 +246,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); + cy.wait(200); helper.clickOnIdle('#columnsizing .unoSetMinimalColumnWidth'); selectFullTable(); @@ -254,6 +260,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); + cy.wait(200); helper.clickOnIdle('#columnsizing .unoSetOptimalColumnWidth'); selectFullTable(); @@ -268,6 +275,7 @@ describe(['tagdesktop', 'tagnextcloud', 'tagproxy'], 'Table operations', functio helper.moveCursor('down', 'shift'); helper.moveCursor('right', 'shift'); + cy.wait(200); helper.clickOnIdle('#columnsizing .unoDistributeColumns'); selectFullTable(); diff --git a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js index e1fa8b60c2a3..10bbce54a32e 100644 --- a/cypress_test/integration_tests/mobile/writer/table_properties_spec.js +++ b/cypress_test/integration_tests/mobile/writer/table_properties_spec.js @@ -229,7 +229,8 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Change table properties / l openTablePanel(); selectFullTable(); - helper.clickOnIdle('.unoDistributeRows button'); + cy.wait(200); + helper.clickOnIdle('.unoDistributeRows'); selectFullTable(); @@ -255,6 +256,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Change table properties / l openTablePanel(); selectFullTable(); + cy.wait(200); helper.clickOnIdle('.unoSetMinimalColumnWidth'); selectFullTable(); @@ -269,6 +271,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Change table properties / l openTablePanel(); selectFullTable(); + cy.wait(200); helper.clickOnIdle('.unoEntireRow'); cy.cGet('#copy-paste-container table').should('exist'); @@ -285,7 +288,8 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Change table properties / l openTablePanel(); selectFullTable(); - helper.clickOnIdle('.unoDistributeColumns button'); + cy.wait(200); + helper.clickOnIdle('.unoDistributeColumns'); selectFullTable(); From ab0bd32554f0a86d4081a4f9e9ce275c331ea613 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20K=C5=82os?= Date: Mon, 1 Apr 2024 09:33:38 +0200 Subject: [PATCH 5/5] cypress: make mobile toolbar tests more reliable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - wait for enabled state - then click internal button Signed-off-by: Szymon Kłos Change-Id: I7663deb668de2e98b007fbace60386a4a7157058 --- .../integration_tests/common/mobile_helper.js | 6 +++- .../mobile/writer/toolbar_spec.js | 36 ++++++++++--------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/cypress_test/integration_tests/common/mobile_helper.js b/cypress_test/integration_tests/common/mobile_helper.js index 7727cdb7ed24..6d1da0a2b6ad 100644 --- a/cypress_test/integration_tests/common/mobile_helper.js +++ b/cypress_test/integration_tests/common/mobile_helper.js @@ -162,7 +162,9 @@ function openInsertionWizard() { cy.log('>> openInsertionWizard - start'); cy.cGet('#toolbar-up #insertion_mobile_wizard') - .should('not.have.class', 'disabled') + .should('not.have.class', 'disabled'); + + cy.cGet('#toolbar-up #insertion_mobile_wizard button') .click(); cy.cGet('#mobile-wizard-content') @@ -179,6 +181,8 @@ function openCommentWizard() { cy.cGet('#toolbar-up #comment_wizard') .should('not.have.class', 'disabled') + + cy.cGet('#toolbar-up #comment_wizard button') .click(); //cy.cGet('#toolbar-up #comment_wizard') diff --git a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js index c193f9d5c024..f55b31db2326 100644 --- a/cypress_test/integration_tests/mobile/writer/toolbar_spec.js +++ b/cypress_test/integration_tests/mobile/writer/toolbar_spec.js @@ -17,7 +17,7 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function() it('State of mobile wizard toolbar item.', function() { // Mobile wizard toolbar button is disabled by default - cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #mobile_wizard').should('have.attr', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now @@ -26,63 +26,64 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function() it('State of insertion mobile wizard toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#toolbar-up #insertion_mobile_wizard').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #insertion_mobile_wizard').should('have.attr', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now - cy.cGet('#toolbar-up #insertion_mobile_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #insertion_mobile_wizard').should('not.have.attr', 'disabled'); }); it('State of comment wizard toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be enabled now - cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled'); }); it('State of undo toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#toolbar-up #undo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('have.attr', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be still disabled - cy.cGet('#toolbar-up #undo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('have.attr', 'disabled'); // Type something in the document helper.typeIntoDocument('x'); // Button should become enabled - cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('not.have.attr', 'disabled'); }); it('State of redo toolbar item.', function() { // Insertion mobile wizard toolbar button is disabled by default - cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled'); // Click on edit button mobileHelper.enableEditingMobile(); // Button should be still disabled - cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled'); // Type something in the document helper.typeIntoDocument('x'); // Button should be still disabled - cy.cGet('#toolbar-up #redo').should('have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('have.attr', 'disabled'); // Do an undo - cy.cGet('#toolbar-up #undo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #undo').should('not.have.attr', 'disabled'); cy.cGet('#toolbar-up #undo').click(); // Button should become enabled - cy.cGet('#toolbar-up #redo').should('not.have.class', 'disabled'); + cy.cGet('#toolbar-up #redo').should('not.have.attr', 'disabled'); }); it('Open and close mobile wizard by toolbar item.', function() { // Click on edit button mobileHelper.enableEditingMobile(); // Click on mobile wizard toolbar item - cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'disabled').click(); + cy.cGet('#toolbar-up #mobile_wizard').should('not.have.attr', 'disabled'); + cy.cGet('#toolbar-up #mobile_wizard button').click(); // Mobile wizard is opened and it has any content cy.cGet('#mobile-wizard-content').should('not.be.empty'); // Toolbar button is checked //cy.cGet('#toolbar-up #mobile_wizard').should('have.class', 'checked'); - cy.cGet('#toolbar-up #mobile_wizard').click(); + cy.cGet('#toolbar-up #mobile_wizard button').click(); // Mobile wizard is closed cy.cGet('#mobile-wizard').should('not.be.visible'); //cy.cGet('#toolbar-up #mobile_wizard').should('not.have.class', 'checked'); @@ -100,12 +101,13 @@ describe(['tagmobile', 'tagnextcloud', 'tagproxy'], 'Toolbar tests', function() // Click on edit button mobileHelper.enableEditingMobile(); // Click on mobile wizard toolbar item - cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'disabled').click(); + cy.cGet('#toolbar-up #comment_wizard').should('not.have.attr', 'disabled'); + cy.cGet('#toolbar-up #comment_wizard button').click(); // Mobile wizard is opened and it has any content cy.cGet('#mobile-wizard-content').should('not.be.empty'); // Toolbar button is checked //cy.cGet('#toolbar-up #comment_wizard').should('have.class', 'checked'); - cy.cGet('#toolbar-up #comment_wizard').click(); + cy.cGet('#toolbar-up #comment_wizard button').click(); // Mobile wizard is closed cy.cGet('#mobile-wizard').should('not.be.visible'); //cy.cGet('#toolbar-up #comment_wizard').should('not.have.class', 'checked');