[Libreoffice-commits] online.git: 2 commits - cypress_test/integration_tests loleaflet/src

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 25 11:28:46 UTC 2020


 cypress_test/integration_tests/common/helper.js            |    4 +-
 cypress_test/integration_tests/mobile/writer/focus_spec.js |   18 +++++++------
 loleaflet/src/control/Control.Toolbar.js                   |    2 -
 loleaflet/src/layer/marker/TextInput.js                    |    2 -
 loleaflet/src/map/Map.js                                   |    8 +++--
 5 files changed, 20 insertions(+), 14 deletions(-)

New commits:
commit 2d36b936ba01463e4dd88a104dac7d3113d232d0
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Tue Mar 24 19:08:35 2020 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 25 12:28:37 2020 +0100

    leaflet: shouldAcceptInput -> canAcceptKeyboardInput
    
    Clearer name to differentiate intent from expectation.
    
    Change-Id: I74cc4c3bca11782bdd9cf72d6af4534357cefa64
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91016
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/cypress_test/integration_tests/common/helper.js b/cypress_test/integration_tests/common/helper.js
index 67b033ff8..31c2a34fc 100644
--- a/cypress_test/integration_tests/common/helper.js
+++ b/cypress_test/integration_tests/common/helper.js
@@ -63,7 +63,7 @@ function enableEditingMobile() {
 // Assert that NO keyboard input is accepted (i.e. keyboard should be HIDDEN).
 function assertNoKeyboardInput() {
 	cy.window().then(win => {
-		var acceptInput = win.shouldAcceptInput();
+		var acceptInput = win.canAcceptKeyboardInput();
 		expect(acceptInput, 'Should accept input').to.equal(false);
 	});
 }
@@ -71,7 +71,7 @@ function assertNoKeyboardInput() {
 // Assert that keyboard input is accepted (i.e. keyboard should be VISIBLE).
 function assertHaveKeyboardInput() {
 	cy.window().then(win => {
-		var acceptInput = win.shouldAcceptInput();
+		var acceptInput = win.canAcceptKeyboardInput();
 		expect(acceptInput, 'Should accept input').to.equal(true);
 	});
 }
diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js
index ed6490846..4df2242af 100644
--- a/cypress_test/integration_tests/mobile/writer/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -200,7 +200,7 @@ describe('Focus tests', function() {
 		//	.should('be.eq', 'clipboard');
 
 		cy.window().then(win => {
-			expect(win.shouldAcceptInput(), 'Should accept input').to.equal(true);
+			expect(win.canAcceptKeyboardInput(), 'Should accept input').to.equal(true);
 		});
 	});
 
@@ -291,7 +291,7 @@ describe('Focus tests', function() {
 			.should('not.have.class', 'checked');
 
 		cy.window().then(win => {
-			win.lastInputState = win.shouldAcceptInput();
+			win.lastInputState = win.canAcceptKeyboardInput();
 		});
 
 		cy.get('#tb_editbar_item_bold')
@@ -301,7 +301,7 @@ describe('Focus tests', function() {
 			.should('have.class', 'checked');
 
 		cy.window().then(win => {
-			var acceptInput = win.shouldAcceptInput();
+			var acceptInput = win.canAcceptKeyboardInput();
 			expect(acceptInput, 'Should accept input').to.equal(win.lastInputState);
 		});
 	});
@@ -320,7 +320,7 @@ describe('Focus tests', function() {
 			.should('not.have.class', 'checked');
 
 		cy.window().then(win => {
-			win.lastInputState = win.shouldAcceptInput();
+			win.lastInputState = win.canAcceptKeyboardInput();
 		});
 
 		cy.get('#tb_editbar_item_italic')
@@ -330,7 +330,7 @@ describe('Focus tests', function() {
 			.should('have.class', 'checked');
 
 		cy.window().then(win => {
-			var acceptInput = win.shouldAcceptInput();
+			var acceptInput = win.canAcceptKeyboardInput();
 			expect(acceptInput, 'Should accept input').to.equal(win.lastInputState);
 		});
 	});
@@ -349,7 +349,7 @@ describe('Focus tests', function() {
 			.should('not.have.class', 'checked');
 
 		cy.window().then(win => {
-			win.lastInputState = win.shouldAcceptInput();
+			win.lastInputState = win.canAcceptKeyboardInput();
 		});
 
 		cy.get('#tb_editbar_item_underline')
@@ -359,7 +359,7 @@ describe('Focus tests', function() {
 			.should('have.class', 'checked');
 
 		cy.window().then(win => {
-			var acceptInput = win.shouldAcceptInput();
+			var acceptInput = win.canAcceptKeyboardInput();
 			expect(acceptInput, 'Should accept input').to.equal(win.lastInputState);
 		});
 	});
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 8243ebf4e..ca854aa1f 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -144,7 +144,7 @@ function onClick(e, id, item, subItem) {
 
 	// In the iOS app we don't want clicking on the toolbar to pop up the keyboard.
 	if (!window.ThisIsTheiOSApp && id !== 'zoomin' && id !== 'zoomout' && id !== 'mobile_wizard' && id !== 'insertion_mobile_wizard') {
-		map.focus(map.shouldAcceptInput()); // Maintain same keyboard state.
+		map.focus(map.canAcceptKeyboardInput()); // Maintain same keyboard state.
 	}
 
 	if (item.disabled) {
diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js
index 0495e077c..046a5d808 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -189,7 +189,7 @@ L.TextInput = L.Layer.extend({
 
 	// Returns true if the last focus was to accept input.
 	// Used to restore the keyboard.
-	shouldAcceptInput: function() {
+	canAcceptKeyboardInput: function() {
 		return this._acceptInput;
 	},
 
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index cc683de13..f8522d1b8 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -333,7 +333,7 @@ L.Map = L.Evented.extend({
 			// There is no way track the keyboard state
 			// programmatically, so the next best thing
 			// is to track what we intended to do.
-			window.shouldAcceptInput = function() { return map.shouldAcceptInput(); };
+			window.canAcceptKeyboardInput = function() { return map.canAcceptKeyboardInput(); };
 
 			// This is used to extract the text we *intended*
 			// to put on the clipboard. There is currently
@@ -970,8 +970,10 @@ L.Map = L.Evented.extend({
 		return document.activeElement === this._textInput.activeElement();
 	},
 
-	shouldAcceptInput: function() {
-		return this._textInput.shouldAcceptInput();
+	// Returns true iff the textarea is enabled and we focused on it.
+	// On mobile, this signifies that the keyboard should be visible.
+	canAcceptKeyboardInput: function() {
+		return this._textInput.canAcceptKeyboardInput();
 	},
 
 	setHelpTarget: function(page) {
commit d6526b498262773b17b7a69a5d849ac51edfeff3
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Mar 21 10:41:31 2020 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Mar 25 12:28:21 2020 +0100

    cypress: check keyboard visibility when editing shapes in writer
    
    Change-Id: I1580f4620459797b95eecb88edbcd12406531618
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90992
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Andras Timar <andras.timar at collabora.com>

diff --git a/cypress_test/integration_tests/mobile/writer/focus_spec.js b/cypress_test/integration_tests/mobile/writer/focus_spec.js
index 8193b3bfe..ed6490846 100644
--- a/cypress_test/integration_tests/mobile/writer/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/writer/focus_spec.js
@@ -191,13 +191,17 @@ describe('Focus tests', function() {
 				var posX = svg[0].getBBox().x + svg[0].getBBox().width / 2;
 				var posY = svg[0].getBBox().y + svg[0].getBBox().height / 2;
 				cy.get('#document-container')
-					.dblclick(posX, posY);
+					.dblclick(posX, posY).wait(100);
 			});
 
 		// Document still has the focus
 		// TODO: Focus is inconsistent here.
 		//cy.document().its('activeElement.className')
 		//	.should('be.eq', 'clipboard');
+
+		cy.window().then(win => {
+			expect(win.shouldAcceptInput(), 'Should accept input').to.equal(true);
+		});
 	});
 
 	it('Focus with hamburger menu.', function() {


More information about the Libreoffice-commits mailing list