2020-04-07 04:22:38 -05:00
|
|
|
/* global cy require*/
|
2020-03-01 09:48:10 -06:00
|
|
|
|
|
|
|
var helper = require('./helper');
|
|
|
|
|
|
|
|
// Assert that Impress is *not* in Text Edit Mode.
|
|
|
|
function assertNotInTextEditMode() {
|
|
|
|
cy.log('Verifying NO Text-Edit context.');
|
|
|
|
|
|
|
|
// In edit mode, we should have the blinking cursor.
|
|
|
|
cy.get('.leaflet-cursor.blinking-cursor')
|
|
|
|
.should('not.exist');
|
|
|
|
cy.get('.leaflet-cursor-container')
|
|
|
|
.should('not.exist');
|
|
|
|
|
leaflet: maintain the keyboard state after toolbar actions
Previously we supressed the keyboard after toolbar
actions, but that is problematic because then the
user is unable to delete/replace selected text,
because the keyboard is hidden and there is no way
of showing keyboard without changing the selection.
Now we maintain the keyboard state, which is likely
visible, since a selection shows the keyboard.
This might not be ideal, because the user might
hide the keyboard on the device and we will restore
it after invoking a toolbar action, but at least
it's more usable now. Unfortunately, there is no
API to track the keyboard visibility.
New Cypress tests added to validate the above.
The tests depend on checking the last keyboard
visibility state in Map, because there is no
reliable (or any?) way to know whether the keyboard
is visible or not. There are many cases where we
actually hide the keyboard, while having the input
focus on the textarea element, so that is no indication
that the keyboard is visible. We do this for usability
purposes. For example, during zooming, when selecting
cells and graphics/shapes, etc.
The purpose of the cell is to validate that we restored
the keyboard visibility or we changed it, depending
on which is expected after each operation.
Change-Id: If0f2e96909ff20753043734789397d190cedb502
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90663
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-03-17 11:02:59 -05:00
|
|
|
helper.assertNoKeyboardInput();
|
|
|
|
|
2020-03-01 09:48:10 -06:00
|
|
|
cy.log('NO Text-Edit context verified.');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Assert that Impress is in Text Edit Mode.
|
|
|
|
function assertInTextEditMode() {
|
|
|
|
cy.log('Verifying Impress in Text-Edit context.');
|
|
|
|
|
|
|
|
// In edit mode, we should have the edit container.
|
|
|
|
cy.get('#doc-clipboard-container')
|
|
|
|
.should('exist');
|
|
|
|
|
|
|
|
cy.get('.leaflet-zoom-animated')
|
|
|
|
.should('exist');
|
|
|
|
cy.get('.leaflet-interactive')
|
|
|
|
.should('exist');
|
|
|
|
|
|
|
|
cy.get('.leaflet-pane.leaflet-overlay-pane svg g')
|
|
|
|
.should('exist');
|
|
|
|
|
|
|
|
helper.assertCursorAndFocus();
|
|
|
|
|
|
|
|
cy.log('Impress Text-Edit context verified.');
|
|
|
|
}
|
|
|
|
|
|
|
|
// Enter some text and confirm we get it back.
|
|
|
|
function typeTextAndVerify(text, expected) {
|
|
|
|
if (!expected)
|
|
|
|
expected = text;
|
|
|
|
|
|
|
|
assertInTextEditMode();
|
|
|
|
|
|
|
|
// Type some text.
|
|
|
|
cy.get('#document-container')
|
|
|
|
.type(text);
|
|
|
|
|
|
|
|
// Still in edit mode.
|
|
|
|
assertInTextEditMode();
|
|
|
|
|
|
|
|
helper.selectAllText();
|
|
|
|
|
|
|
|
helper.expectTextForClipboard(expected);
|
|
|
|
}
|
|
|
|
module.exports.assertNotInTextEditMode = assertNotInTextEditMode;
|
|
|
|
module.exports.assertInTextEditMode = assertInTextEditMode;
|
|
|
|
module.exports.typeTextAndVerify = typeTextAndVerify;
|