[Libreoffice-commits] online.git: Branch 'feature/cypress_integration' - 2 commits - cypress_test/integration_tests loleaflet/.eslintrc loleaflet/js loleaflet/src
Tamás Zolnai (via logerrit)
logerrit at kemper.freedesktop.org
Thu Jan 16 14:48:51 UTC 2020
cypress_test/integration_tests/desktop/example_desktop_test_spec.js | 24 +-
cypress_test/integration_tests/desktop/example_desktop_test_spec2.js | 24 +-
cypress_test/integration_tests/mobile/focus_spec.js | 117 ++++++++++
cypress_test/integration_tests/mobile/toolbar_spec.js | 98 ++++----
loleaflet/.eslintrc | 3
loleaflet/js/global.js | 18 -
loleaflet/src/control/Control.ContextMenu.js | 2
loleaflet/src/control/Control.DownloadProgress.js | 2
loleaflet/src/control/Control.Header.js | 4
loleaflet/src/control/Control.Infobar.js | 2
loleaflet/src/control/Control.JSDialogBuilder.js | 16 -
loleaflet/src/control/Control.LokDialog.js | 2
loleaflet/src/control/Control.Menubar.js | 10
loleaflet/src/control/Control.MobileWizard.js | 6
loleaflet/src/control/Control.PartsPreview.js | 2
loleaflet/src/control/Control.RowHeader.js | 2
loleaflet/src/control/Control.Tabs.js | 2
loleaflet/src/control/Control.Toolbar.js | 12 -
loleaflet/src/control/Signing.js | 4
loleaflet/src/control/Toolbar.js | 2
loleaflet/src/dom/Draggable.js | 4
loleaflet/src/layer/CalcGridLines.js | 2
loleaflet/src/layer/marker/TextInput.js | 2
loleaflet/src/layer/tile/GridLayer.js | 4
loleaflet/src/layer/tile/TileLayer.TableOverlay.js | 2
loleaflet/src/layer/tile/TileLayer.js | 4
loleaflet/src/layer/vector/Path.Drag.js | 2
loleaflet/src/map/Clipboard.js | 10
28 files changed, 250 insertions(+), 132 deletions(-)
New commits:
commit 9a3db385c75a690e0c564fba05bc2e3176c62540
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Jan 16 15:44:23 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Jan 16 15:46:38 2020 +0100
eslint: Enable "semi" rule as an error.
This checks whether all statements end with a semicolon.
We already use this rule in the code, so I enable to check
this rule by eslint to keep the code consistent.
Change-Id: I5ea46376d2b6fb488224d4d69e4d117139763a8c
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
index 8a39b455f..e6762e746 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec.js
@@ -11,29 +11,29 @@ describe('Example test suit 1', function() {
// Open test document
cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
- Cypress.env('WORKDIR') + 'simple.odt')
+ Cypress.env('WORKDIR') + 'simple.odt');
// Wait for the document to fully load
- cy.get('.leaflet-tile-loaded')
+ cy.get('.leaflet-tile-loaded');
// Select a text
- cy.get('#document-container').dblclick()
- cy.get('.leaflet-marker-icon')
+ cy.get('#document-container').dblclick();
+ cy.get('.leaflet-marker-icon');
// Click on bold toolbar button
- cy.get('#tb_editbar_item_bold').click()
+ cy.get('#tb_editbar_item_bold').click();
// Remove selection and do a reselection
- cy.get('#document-container').click()
+ cy.get('#document-container').click();
cy.get('.leaflet-marker-icon').should('not.be.visible');
- cy.get('#document-container').dblclick()
- cy.get('.leaflet-marker-icon')
+ cy.get('#document-container').dblclick();
+ cy.get('.leaflet-marker-icon');
// Bold toolbar button is checked
- cy.get('#tb_editbar_item_bold table.w2ui-button.checked')
+ cy.get('#tb_editbar_item_bold table.w2ui-button.checked');
// Click on bold toolbar button
- cy.get('#tb_editbar_item_bold').click()
- })
-})
+ cy.get('#tb_editbar_item_bold').click();
+ });
+});
diff --git a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
index 163a28c84..8eb72e561 100644
--- a/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
+++ b/cypress_test/integration_tests/desktop/example_desktop_test_spec2.js
@@ -11,29 +11,29 @@ describe('Example test suit 2', function() {
// Open test document
cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
- Cypress.env('WORKDIR') + 'simple.odt')
+ Cypress.env('WORKDIR') + 'simple.odt');
// Wait for the document to fully load
- cy.get('.leaflet-tile-loaded')
+ cy.get('.leaflet-tile-loaded');
// Select a text
- cy.get('#document-container').dblclick()
- cy.get('.leaflet-marker-icon')
+ cy.get('#document-container').dblclick();
+ cy.get('.leaflet-marker-icon');
// Click on bold toolbar button
- cy.get('#tb_editbar_item_italic').click()
+ cy.get('#tb_editbar_item_italic').click();
// Remove selection and do a reselection
- cy.get('#document-container').click()
+ cy.get('#document-container').click();
cy.get('.leaflet-marker-icon').should('not.be.visible');
- cy.get('#document-container').dblclick()
- cy.get('.leaflet-marker-icon')
+ cy.get('#document-container').dblclick();
+ cy.get('.leaflet-marker-icon');
// Bold toolbar button is checked
- cy.get('#tb_editbar_item_italic table.w2ui-button.checked')
+ cy.get('#tb_editbar_item_italic table.w2ui-button.checked');
// Click on bold toolbar button
- cy.get('#tb_editbar_item_italic').click()
- })
-})
+ cy.get('#tb_editbar_item_italic').click();
+ });
+});
diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/focus_spec.js
index 78bef645f..705bfc447 100644
--- a/cypress_test/integration_tests/mobile/focus_spec.js
+++ b/cypress_test/integration_tests/mobile/focus_spec.js
@@ -16,18 +16,18 @@ describe('Focus tests', function() {
// Wait for the document to fully load
cy.get('.leaflet-tile-loaded');
- })
+ });
it('Focus after document fully loaded.', function() {
// The document body should have the focus
cy.document().its('activeElement.tagName')
- .should('be.eq', 'BODY')
- })
+ .should('be.eq', 'BODY');
+ });
it('Focus after closing a dialog.', function() {
// The document body has the focus first
cy.document().its('activeElement.tagName')
- .should('be.eq', 'BODY')
+ .should('be.eq', 'BODY');
// Click on edit button
cy.get('#mobile-edit-button').click();
@@ -41,7 +41,7 @@ describe('Focus tests', function() {
// The dialog grabs the focus
cy.document().its('activeElement.className')
- .should('be.eq', 'loleaflet-annotation-textarea')
+ .should('be.eq', 'loleaflet-annotation-textarea');
// Close the dialog
cy.contains('Cancel').click();
@@ -49,13 +49,13 @@ describe('Focus tests', function() {
// The document should have the focus again
cy.document().its('activeElement.tagName')
- .should('be.eq', 'BODY')
- })
+ .should('be.eq', 'BODY');
+ });
it('Focus when using insertion mobile wizard.', function() {
// The document body has the focus first
cy.document().its('activeElement.tagName')
- .should('be.eq', 'BODY')
+ .should('be.eq', 'BODY');
// Click on edit button
cy.get('#mobile-edit-button').click();
@@ -71,22 +71,22 @@ describe('Focus tests', function() {
// This fails here: the document still has the focus
// The wizard changes the focus
//cy.document().its('activeElement.className')
- // .should('be.eq', 'clipboard')
+ // .should('be.eq', 'clipboard');
// Close the mobile wizard
- cy.get('#tb_actionbar_item_insertion_mobile_wizard').click()
+ cy.get('#tb_actionbar_item_insertion_mobile_wizard').click();
cy.get('#mobile-wizard').should('not.be.visible');
// This fails here: the focus is not on the document body
// The document should have the focus again
//cy.document().its('activeElement.tagName')
- // .should('be.eq', 'BODY')
- })
+ // .should('be.eq', 'BODY');
+ });
it('Focus after insertion.', function() {
// The document body has the focus first
cy.document().its('activeElement.tagName')
- .should('be.eq', 'BODY')
+ .should('be.eq', 'BODY');
// Click on edit button
cy.get('#mobile-edit-button').click();
@@ -97,7 +97,7 @@ describe('Focus tests', function() {
.click();
cy.get('#mobile-wizard-content')
- .should('not.be.empty')
+ .should('not.be.empty');
// Select More Fields
cy.get('.ui-header.level-0.mobile-wizard.ui-widget .sub-menu-title')
@@ -112,6 +112,6 @@ describe('Focus tests', function() {
// This fails here: the focus is not on the document body
// The document should have the focus again
//cy.document().its('activeElement.tagName')
- // .should('be.eq', 'BODY')
- })
-})
+ // .should('be.eq', 'BODY');
+ });
+});
diff --git a/cypress_test/integration_tests/mobile/toolbar_spec.js b/cypress_test/integration_tests/mobile/toolbar_spec.js
index 3ef580d3a..29f9a67bf 100644
--- a/cypress_test/integration_tests/mobile/toolbar_spec.js
+++ b/cypress_test/integration_tests/mobile/toolbar_spec.js
@@ -10,110 +10,110 @@ describe('Toolbar tests', function() {
});
// Open test document
- cy.viewport('iphone-3')
+ cy.viewport('iphone-3');
cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
- Cypress.env('WORKDIR') + 'empty.odt')
+ Cypress.env('WORKDIR') + 'empty.odt');
// Wait for the document to fully load
- cy.get('.leaflet-tile-loaded')
+ cy.get('.leaflet-tile-loaded');
});
it('State of mobile wizard toolbar item.', function() {
// Mobile wizard toolbar button is disabled by default
cy.get('#tb_actionbar_item_mobile_wizard')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Button should be enabled now
cy.get('#tb_actionbar_item_mobile_wizard')
- .should('not.have.class', 'disabled')
- })
+ .should('not.have.class', 'disabled');
+ });
it('State of insertion mobile wizard toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Button should be enabled now
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
- .should('not.have.class', 'disabled')
- })
+ .should('not.have.class', 'disabled');
+ });
it('State of insert comment toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.get('#tb_actionbar_item_insertcomment')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Button should be enabled now
cy.get('#tb_actionbar_item_insertcomment')
- .should('not.have.class', 'disabled')
- })
+ .should('not.have.class', 'disabled');
+ });
it('State of undo toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.get('#tb_actionbar_item_undo')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Button should be still disabled
cy.get('#tb_actionbar_item_undo')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Type somthing in the document
- cy.get('#document-container').type('x')
+ cy.get('#document-container').type('x');
// Button should become enabled
cy.get('#tb_actionbar_item_undo')
- .should('not.have.class', 'disabled')
- })
+ .should('not.have.class', 'disabled');
+ });
it('State of redo toolbar item.', function() {
// Insertion mobile wizard toolbar button is disabled by default
cy.get('#tb_actionbar_item_redo')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Button should be still disabled
cy.get('#tb_actionbar_item_redo')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Type somthing in the document
- cy.get('#document-container').type('x')
+ cy.get('#document-container').type('x');
// Button should be still disabled
cy.get('#tb_actionbar_item_redo')
- .should('have.class', 'disabled')
+ .should('have.class', 'disabled');
// Do an undo
cy.get('#tb_actionbar_item_undo')
- .should('not.have.class', 'disabled')
- cy.get('#tb_actionbar_item_undo').click()
+ .should('not.have.class', 'disabled');
+ cy.get('#tb_actionbar_item_undo').click();
// Button should become enabled
cy.get('#tb_actionbar_item_redo')
- .should('not.have.class', 'disabled')
- })
+ .should('not.have.class', 'disabled');
+ });
it('Open and close mobile wizard by toolbar item.', function() {
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Click on mobile wizard toolbar item
cy.get('#tb_actionbar_item_mobile_wizard')
.should('not.have.class', 'disabled')
- .click()
+ .click();
// Mobile wizard is opened and it has any content
cy.get('#mobile-wizard-content')
@@ -121,36 +121,36 @@ describe('Toolbar tests', function() {
// Toolbar button is checked
cy.get('#tb_actionbar_item_mobile_wizard table')
- .should('have.class', 'checked')
+ .should('have.class', 'checked');
cy.get('#tb_actionbar_item_mobile_wizard')
- .click()
+ .click();
// Mobile wizard is closed
cy.get('#mobile_wizard')
.should('not.be.visible');
cy.get('#tb_actionbar_item_mobile_wizard table')
- .should('not.have.class', 'checked')
+ .should('not.have.class', 'checked');
// Open mobile wizard again
cy.get('#tb_actionbar_item_mobile_wizard')
- .click()
+ .click();
// Mobile wizard is opened and it has any content
// TODO: fix this bug
/*cy.get('#mobile-wizard-content')
.should('not.be.empty'); */
- })
+ });
it('Open and close insertion mobile wizard by toolbar item.', function() {
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Click on toolbar item
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
.should('not.have.class', 'disabled')
- .click()
+ .click();
// Mobile wizard is opened and it has any content
cy.get('#mobile-wizard-content')
@@ -158,36 +158,36 @@ describe('Toolbar tests', function() {
// Toolbar button is checked
cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
- .should('have.class', 'checked')
+ .should('have.class', 'checked');
// Click on toolbar item again
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
- .click()
+ .click();
// Mobile wizard is closed
cy.get('#mobile_wizard')
.should('not.be.visible');
cy.get('#tb_actionbar_item_insertion_mobile_wizard table')
- .should('not.have.class', 'checked')
+ .should('not.have.class', 'checked');
// Open mobile wizard again
cy.get('#tb_actionbar_item_insertion_mobile_wizard')
- .click()
+ .click();
// Mobile wizard is opened and it has any content
cy.get('#mobile-wizard-content')
.should('not.be.empty');
- })
+ });
it('Open insert comment dialog by toolbar item.', function() {
// Click on edit button
- cy.get('#mobile-edit-button').click()
+ cy.get('#mobile-edit-button').click();
// Click on toolbar item
cy.get('#tb_actionbar_item_insertcomment')
.should('not.have.class', 'disabled')
- .click()
+ .click();
// Comment insertion dialog is opened
cy.get('.loleaflet-annotation-table')
@@ -195,9 +195,9 @@ describe('Toolbar tests', function() {
// Close the dialog
cy.contains('Cancel')
- .click()
+ .click();
cy.get('.loleaflet-annotation-table')
.should('be.not.visible');
- })
-})
+ });
+});
diff --git a/loleaflet/.eslintrc b/loleaflet/.eslintrc
index 48a6d2ad5..a5a054eef 100644
--- a/loleaflet/.eslintrc
+++ b/loleaflet/.eslintrc
@@ -16,7 +16,8 @@
"strict": 0,
"key-spacing": 0,
"no-shadow": 0,
- "no-console": 0
+ "no-console": 0,
+ "semi": 2
},
"globals": {
"L": true,
diff --git a/loleaflet/js/global.js b/loleaflet/js/global.js
index 8445ecb4f..9e5578163 100644
--- a/loleaflet/js/global.js
+++ b/loleaflet/js/global.js
@@ -26,15 +26,15 @@
};
this.onopen = function() {
};
- }
+ };
global.FakeWebSocket.prototype.close = function() {
- }
+ };
global.FakeWebSocket.prototype.send = function(data) {
this.sendCounter++;
window.postMobileMessage(data);
- }
+ };
// If not debug, don't print anything on the console
// except in tile debug mode (Ctrl-Shift-Alt-d)
@@ -71,7 +71,7 @@
}
return false;
- }
+ };
}
// fix jquery-ui
@@ -122,7 +122,7 @@
wopiParams = { 'access_header': global.accessHeader };
}
docParams = Object.keys(wopiParams).map(function(key) {
- return encodeURIComponent(key) + '=' + encodeURIComponent(wopiParams[key])
+ return encodeURIComponent(key) + '=' + encodeURIComponent(wopiParams[key]);
}).join('&');
} else {
global.docURL = filePath;
@@ -168,15 +168,15 @@
}
global.socket.send(msg);
}
- }
+ };
global.socket.onerror = function (event) {
console.log(event);
- }
+ };
global.socket.onclose = function (event) {
console.log(event);
- }
+ };
global.socket.onmessage = function (event) {
if (typeof global.socket._onMessage === 'function') {
@@ -184,7 +184,7 @@
} else {
global.queueMsg.push(event.data);
}
- }
+ };
global.socket.binaryType = 'arraybuffer';
diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 954dab877..a1c364c0c 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -263,7 +263,7 @@ L.Control.ContextMenu = L.Control.extend({
if (itemCommand.includes('sep'))
return null;
- var itemText = ''
+ var itemText = '';
if (menu.name)
itemText = menu.name;
diff --git a/loleaflet/src/control/Control.DownloadProgress.js b/loleaflet/src/control/Control.DownloadProgress.js
index 2fce6a714..7ad98d053 100644
--- a/loleaflet/src/control/Control.DownloadProgress.js
+++ b/loleaflet/src/control/Control.DownloadProgress.js
@@ -155,7 +155,7 @@ L.Control.DownloadProgress = L.Control.extend({
var reader = new FileReader();
reader.onload = function() {
var text = reader.result;
- console.log('async clipboard parse done: ' + text.substring(0, 256))
+ console.log('async clipboard parse done: ' + text.substring(0, 256));
var idx = text.indexOf('<!DOCTYPE HTML');
if (idx > 0)
text = text.substring(idx, text.length);
diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index 7f77a1990..76eea58ee 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -222,7 +222,7 @@ L.Control.Header = L.Control.extend({
// Called whenever the cell cursor is in a cell corresponding to the cursorPos-th
// column/row.
updateCurrent: function (cursorPos, slim) {
- if (!this._tickMap) {return}
+ if (!this._tickMap) {return;}
if (cursorPos < 0) {
this.unselect(this._tickMap.getGap(this._current));
@@ -845,7 +845,7 @@ L.Control.Header.GapTickMap = L.Class.extend({
end: end,
size: end - start,
pos: end,
- }
+ };
},
// Returns true when the i-th gap has zero size.
diff --git a/loleaflet/src/control/Control.Infobar.js b/loleaflet/src/control/Control.Infobar.js
index ae1443177..b00d0cdb2 100644
--- a/loleaflet/src/control/Control.Infobar.js
+++ b/loleaflet/src/control/Control.Infobar.js
@@ -25,7 +25,7 @@ L.Control.Infobar = L.Control.extend({
var win = window.open(e.action, '_blank');
win.focus();
}
- }
+ };
}
vex.dialog.open({
diff --git a/loleaflet/src/control/Control.JSDialogBuilder.js b/loleaflet/src/control/Control.JSDialogBuilder.js
index eaa414018..dd32aedda 100644
--- a/loleaflet/src/control/Control.JSDialogBuilder.js
+++ b/loleaflet/src/control/Control.JSDialogBuilder.js
@@ -123,7 +123,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
$(controlElement).click(
// avoid to access mutable variable (that is `i` dependent) in closure
(function (lhandler, leventData) {
- return function() { lhandler(leventData) };
+ return function() { lhandler(leventData); };
})(handler, eventData)
);
}
@@ -246,7 +246,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
var icon = L.DomUtil.create('img', 'menu-entry-icon', leftDiv);
icon.src = iconPath;
icon.alt = '';
- titleClass = 'menu-entry-with-icon'
+ titleClass = 'menu-entry-with-icon';
}
var titleSpan = L.DomUtil.create('span', titleClass, leftDiv);
@@ -269,7 +269,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
} else {
titleSpan.innerHTML = data.text;
}
- }
+ };
updateCallback ? updateCallback(titleSpan) : updateFunction(titleSpan);
@@ -528,7 +528,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
$(checkbox).attr('checked', 'checked');
else if (state)
$(checkbox).removeAttr('checked', 'checked');
- }
+ };
updateFunction();
@@ -942,7 +942,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
value = data.children[0].text;
$(spinfield).attr('value', builder._cleanValueFromUnits(value));
- }
+ };
updateFunction();
@@ -1187,7 +1187,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
$(button).addClass('selected');
else
$(button).removeClass('selected');
- }
+ };
updateFunction();
@@ -1444,7 +1444,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
if (window.insertionMobileWizard)
window.onClick(null, 'insertion_mobile_wizard');
else if (window.mobileMenuWizard)
- $('#main-menu-state').click()
+ $('#main-menu-state').click();
else if (window.contextMenuWizard) {
window.contextMenuWizard = false;
builder.map.fire('closemobilewizard');
@@ -1460,7 +1460,7 @@ L.Control.JSDialogBuilder = L.Control.extend({
data.checked && data.checked === true) {
return;
}
- builder.map.sendUnoCommand(data.command)
+ builder.map.sendUnoCommand(data.command);
}
});
} else {
diff --git a/loleaflet/src/control/Control.LokDialog.js b/loleaflet/src/control/Control.LokDialog.js
index 2abdc0246..3478729c4 100644
--- a/loleaflet/src/control/Control.LokDialog.js
+++ b/loleaflet/src/control/Control.LokDialog.js
@@ -790,7 +790,7 @@ L.Control.LokDialog = L.Control.extend({
startX: offsetX,
startY: offsetY,
initScale: ratio
- }
+ };
var transformation = {
translate: { x: offsetX, y: offsetY },
scale: ratio,
diff --git a/loleaflet/src/control/Control.Menubar.js b/loleaflet/src/control/Control.Menubar.js
index fe28ce9a6..18b14c3ed 100644
--- a/loleaflet/src/control/Control.Menubar.js
+++ b/loleaflet/src/control/Control.Menubar.js
@@ -846,11 +846,11 @@ L.Control.Menubar = L.Control.extend({
return item.name === _(style);
};
- var foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageHeader', 'text'))
+ var foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageHeader', 'text'));
if (foundMenu && foundMenu.menu.find(findFunction) === undefined)
foundMenu.menu.push({name: _(style), tag: style, uno: constHeader + encodeURIComponent(style) + constArg});
- foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageFooter', 'text'))
+ foundMenu = this._findSubMenuByName(target, _UNO('.uno:InsertPageFooter', 'text'));
if (foundMenu && foundMenu.menu.find(findFunction) === undefined)
foundMenu.menu.push({name: _(style), tag: style, uno: constFooter + encodeURIComponent(style) + constArg});
}
@@ -1425,7 +1425,7 @@ L.Control.Menubar = L.Control.extend({
if (id && id == 'menu-' + targetId) {
return true;
}
- return false
+ return false;
});
return found.length ? found : null;
},
@@ -1483,8 +1483,8 @@ L.Control.Menubar = L.Control.extend({
var docType = this._map.getDocType();
var target = this.options['mobileInsertMenu'][docType];
- var menuStructure = this._generateMenuStructure(target, docType, true)
- return menuStructure
+ var menuStructure = this._generateMenuStructure(target, docType, true);
+ return menuStructure;
},
_generateMenuStructure: function(item, docType, mainMenu) {
diff --git a/loleaflet/src/control/Control.MobileWizard.js b/loleaflet/src/control/Control.MobileWizard.js
index f186a2412..1bf384762 100644
--- a/loleaflet/src/control/Control.MobileWizard.js
+++ b/loleaflet/src/control/Control.MobileWizard.js
@@ -162,11 +162,11 @@ L.Control.MobileWizard = L.Control.extend({
this._hideWizard();
this._currentDepth = 0;
if (window.mobileWizard === true) {
- w2ui['actionbar'].click('mobile_wizard')
+ w2ui['actionbar'].click('mobile_wizard');
} else if (window.insertionMobileWizard === true) {
- w2ui['actionbar'].click('insertion_mobile_wizard')
+ w2ui['actionbar'].click('insertion_mobile_wizard');
} else if (window.mobileMenuWizard === true) {
- $('#main-menu-state').click()
+ $('#main-menu-state').click();
} else if (window.contextMenuWizard) {
window.contextMenuWizard = false;
this.map.fire('closemobilewizard');
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 12c5bab19..94b6c6af4 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -429,7 +429,7 @@ L.Control.PartsPreview = L.Control.extend({
if (elem) {
elem.setAttribute('draggable', true);
elem.addEventListener('dragstart', this._handleDragStart, false);
- elem.addEventListener('dragenter', this._handleDragEnter, false)
+ elem.addEventListener('dragenter', this._handleDragEnter, false);
elem.addEventListener('dragover', this._handleDragOver, false);
elem.addEventListener('dragleave', this._handleDragLeave, false);
elem.addEventListener('drop', this._handleDrop, false);
diff --git a/loleaflet/src/control/Control.RowHeader.js b/loleaflet/src/control/Control.RowHeader.js
index c29d64000..8709a72c5 100644
--- a/loleaflet/src/control/Control.RowHeader.js
+++ b/loleaflet/src/control/Control.RowHeader.js
@@ -243,7 +243,7 @@ L.Control.RowHeader = L.Control.Header.extend({
var w = width - 4;
var size = 2;
var offset = 1;
- ctx.fillStyle = '#BBBBBB'
+ ctx.fillStyle = '#BBBBBB';
ctx.fillRect(x + 2, center - size - offset, w - 4, size);
ctx.fillRect(x + 2, center + offset, w - 4, size);
}
diff --git a/loleaflet/src/control/Control.Tabs.js b/loleaflet/src/control/Control.Tabs.js
index eac204c3b..aaa4f1b28 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -138,7 +138,7 @@ L.Control.Tabs = L.Control.extend({
return function() {
this._tabForContextMenu = j;
$('spreadsheet-tab' + j).contextMenu();
- }
+ };
}(i).bind(this));
tab.textContent = e.partNames[i];
diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index b22f5e479..7f28579e7 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -264,10 +264,10 @@ function onClick(e, id, item, subItem) {
onColorPick(id, e.color);
}
else if (id === 'backcolor' && typeof e.color !== 'undefined') {
- onColorPick(id, e.color)
+ onColorPick(id, e.color);
}
else if (id === 'backgroundcolor' && typeof e.color !== 'undefined') {
- onColorPick(id, e.color)
+ onColorPick(id, e.color);
}
else if (id === 'sum') {
map.sendUnoCommand('.uno:AutoSum');
@@ -501,7 +501,7 @@ function insertTable() {
map._socket.sendMessage(msg);
- closePopup()
+ closePopup();
}
}, '.col');
}
@@ -1073,7 +1073,7 @@ function initNormalToolbar() {
});
}
- toolbar = $('#spreadsheet-toolbar')
+ toolbar = $('#spreadsheet-toolbar');
toolbar.w2toolbar({
name: 'spreadsheet-toolbar',
tooltip: 'bottom',
@@ -1732,7 +1732,7 @@ function onDocLayerInit() {
tags: true,
sorter: function(data) { return data.sort(function(a, b) {
return parseFloat(a.text) - parseFloat(b.text);
- })}
+ });}
});
$('.fontsizes-select').off('select2:select', onFontSizeSelect).on('select2:select', onFontSizeSelect);
}
@@ -2192,7 +2192,7 @@ function onUpdatePermission(e) {
// copy the first array
var items = toolbar.items.slice();
for (var idx in items) {
- var found = enabledButtons.filter(function(id) { return id === items[idx].id });
+ var found = enabledButtons.filter(function(id) { return id === items[idx].id; });
var alwaysEnable = found.length !== 0;
if (e.perm === 'edit') {
diff --git a/loleaflet/src/control/Signing.js b/loleaflet/src/control/Signing.js
index 4489f325f..7a253ddf0 100644
--- a/loleaflet/src/control/Signing.js
+++ b/loleaflet/src/control/Signing.js
@@ -12,7 +12,7 @@ var passportCertificates = [];
var oldtoolbarSize = null;
var _map = null;
-var currentDocumentSigningStatus = 'N/A'
+var currentDocumentSigningStatus = 'N/A';
var awaitForDocumentStatusToUpload = false;
var currentDocumentType = null;
@@ -389,7 +389,7 @@ function vereignExportSignAndUploadToVereign(documentType) {
wopiUrl: getVereignWopiURL() + 'files',
token: resultArray[i].AccessToken,
type: documentType
- }
+ };
var blob = new Blob(['exportsignanduploaddocument\n', JSON.stringify(parameters)]);
_map._socket.sendMessage(blob);
}
diff --git a/loleaflet/src/control/Toolbar.js b/loleaflet/src/control/Toolbar.js
index cd912777e..2d9e007f2 100644
--- a/loleaflet/src/control/Toolbar.js
+++ b/loleaflet/src/control/Toolbar.js
@@ -231,7 +231,7 @@ L.Map.include({
buttons: {},
afterOpen: function() {
var $vexContent = $(this.contentEl);
- this.contentEl.style.width = w + 'px'
+ this.contentEl.style.width = w + 'px';
map.enable(false);
var i;
// Display keyboard shortcut or online help
diff --git a/loleaflet/src/dom/Draggable.js b/loleaflet/src/dom/Draggable.js
index d3183704a..5ed23ed73 100644
--- a/loleaflet/src/dom/Draggable.js
+++ b/loleaflet/src/dom/Draggable.js
@@ -151,9 +151,9 @@ L.Draggable = L.Evented.extend({
this._newPos = this._startPos.add(offset);
if (this._freezeY)
- this._newPos.y = this._startPos.y
+ this._newPos.y = this._startPos.y;
if (this._freezeX)
- this._newPos.x = this._startPos.x
+ this._newPos.x = this._startPos.x;
this._moving = true;
diff --git a/loleaflet/src/layer/CalcGridLines.js b/loleaflet/src/layer/CalcGridLines.js
index 8d745999d..4b4e58d3a 100644
--- a/loleaflet/src/layer/CalcGridLines.js
+++ b/loleaflet/src/layer/CalcGridLines.js
@@ -51,7 +51,7 @@ L.CalcGridLines = L.LayerGroup.extend({
str = 'M0 0';
}
- this._setPath(layer, str, closed)
+ this._setPath(layer, str, closed);
}.bind(this.options.renderer);
}
diff --git a/loleaflet/src/layer/marker/TextInput.js b/loleaflet/src/layer/marker/TextInput.js
index bc6d047a7..6a404298e 100644
--- a/loleaflet/src/layer/marker/TextInput.js
+++ b/loleaflet/src/layer/marker/TextInput.js
@@ -56,7 +56,7 @@ L.TextInput = L.Layer.extend({
}).on('dragend', this._onCursorHandlerDragEnd, this);
var that = this;
- this._selectionHandler = function(ev) { that._onEvent(ev); }
+ this._selectionHandler = function(ev) { that._onEvent(ev); };
// Auto-correct characters can trigger auto-correction, but
// must be sent as key-up/down if we want correction.
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 4db50a473..470d611d5 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -25,7 +25,7 @@ L.GridLayer = L.Layer.extend({
initialize: function (options) {
L.setOptions(this, options);
- this._resetClientVisArea()
+ this._resetClientVisArea();
},
onAdd: function () {
@@ -744,7 +744,7 @@ L.GridLayer = L.Layer.extend({
// Visible area is dirty, update it on the server
this._map._socket.sendMessage(newClientVisibleArea);
if (!this._map._fatal && this._map._active && this._map._socket.connected())
- this._clientVisibleArea = newClientVisibleArea
+ this._clientVisibleArea = newClientVisibleArea;
if (this._debug) {
this._debugInfo.clearLayers();
for (var key in this._tiles) {
diff --git a/loleaflet/src/layer/tile/TileLayer.TableOverlay.js b/loleaflet/src/layer/tile/TileLayer.TableOverlay.js
index 25e8f93e7..12b45d5df 100644
--- a/loleaflet/src/layer/tile/TileLayer.TableOverlay.js
+++ b/loleaflet/src/layer/tile/TileLayer.TableOverlay.js
@@ -327,7 +327,7 @@ L.TileLayer.include({
type : 'int32',
value : offset
}
- }
+ };
this._map.sendUnoCommand('.uno:TableChangeCurrentBorderPosition', params);
}
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 8d31a7647..861846e3b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -773,7 +773,7 @@ L.TileLayer = L.GridLayer.extend({
index: idx,
enabled: true,
children: []
- }
+ };
entries.push(entry);
entries[entries.length-1].children[0] = {
id: '',
@@ -1147,7 +1147,7 @@ L.TileLayer = L.GridLayer.extend({
}
if (this._map._viewInfo[editorId])
- this._map.fire('updateEditorName', {username: this._map._viewInfo[editorId].username})
+ this._map.fire('updateEditorName', {username: this._map._viewInfo[editorId].username});
},
_onInvalidateViewCursorMsg: function (textMsg) {
diff --git a/loleaflet/src/layer/vector/Path.Drag.js b/loleaflet/src/layer/vector/Path.Drag.js
index 0b8193247..47fd8e0e2 100644
--- a/loleaflet/src/layer/vector/Path.Drag.js
+++ b/loleaflet/src/layer/vector/Path.Drag.js
@@ -271,7 +271,7 @@ L.Handler.PathDrag = L.Handler.extend(/** @lends L.Path.Drag.prototype */ {
if (!this._path.options.manualDrag && !moved) {
this._path._map._handleDOMEvent(this._mouseDown);
- this._path._map._handleDOMEvent(evt)
+ this._path._map._handleDOMEvent(evt);
}
},
diff --git a/loleaflet/src/map/Clipboard.js b/loleaflet/src/map/Clipboard.js
index a3a4c3add..b4d76884a 100644
--- a/loleaflet/src/map/Clipboard.js
+++ b/loleaflet/src/map/Clipboard.js
@@ -39,7 +39,7 @@ L.Clipboard = L.Class.extend({
this._resetDiv();
var that = this;
- var beforeSelect = function(ev) { return that._beforeSelect(ev); }
+ var beforeSelect = function(ev) { return that._beforeSelect(ev); };
if (L.Browser.isInternetExplorer)
{
document.addEventListener('cut', function(ev) { return that.cut(ev); });
@@ -261,7 +261,7 @@ L.Clipboard = L.Class.extend({
'POST', dest, formData,
function() {
console.log('up-load done, now paste');
- that._map._socket.sendMessage('uno .uno:Paste')
+ that._map._socket.sendMessage('uno .uno:Paste');
},
function(progress) { return 50 + progress/2; }
);
@@ -289,7 +289,7 @@ L.Clipboard = L.Class.extend({
'POST', dest, formData,
function() {
console.log('up-load of fallback done, now paste');
- that._map._socket.sendMessage('uno .uno:Paste')
+ that._map._socket.sendMessage('uno .uno:Paste');
},
function(progress) { return 50 + progress/2; },
function() {
@@ -381,7 +381,7 @@ L.Clipboard = L.Class.extend({
if (files !== null)
{
for (var f = 0; f < files.length; ++f)
- this._asyncReadPasteImage(files[f])
+ this._asyncReadPasteImage(files[f]);
}
else // IE / Edge
this._asyncReadPasteImage(dataTransfer.items[t].getAsFile());
@@ -612,7 +612,7 @@ L.Clipboard = L.Class.extend({
console.log('help did not arive for ' + operation);
that._warnCopyPaste();
}
- }, 150 /* ms */)
+ }, 150 /* ms */);
},
// Pull UNO clipboard commands out from menus and normal user input.
commit 9a056ebd4691331277fe9eff722f3948c18ea028
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Thu Jan 16 15:00:54 2020 +0100
Commit: Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Thu Jan 16 15:46:32 2020 +0100
cypress: mobile: add some examples for testing focus.
Change-Id: I63267bdd1d4b4db0d30da78c61b82c5d7d5535dc
diff --git a/cypress_test/integration_tests/mobile/focus_spec.js b/cypress_test/integration_tests/mobile/focus_spec.js
new file mode 100644
index 000000000..78bef645f
--- /dev/null
+++ b/cypress_test/integration_tests/mobile/focus_spec.js
@@ -0,0 +1,117 @@
+/* global describe it cy Cypress beforeEach*/
+
+describe('Focus tests', function() {
+ beforeEach(function() {
+ // Get a clean test document
+ cy.task('copyFile', {
+ sourceDir: Cypress.env('DATA_FOLDER'),
+ destDir: Cypress.env('WORKDIR'),
+ fileName: 'empty.odt',
+ });
+
+ // Open test document
+ cy.viewport('iphone-3');
+ cy.visit('http://localhost:9980/loleaflet/fc04ba550/loleaflet.html?file_path=file://' +
+ Cypress.env('WORKDIR') + 'empty.odt');
+
+ // Wait for the document to fully load
+ cy.get('.leaflet-tile-loaded');
+ })
+
+ it('Focus after document fully loaded.', function() {
+ // The document body should have the focus
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY')
+ })
+
+ it('Focus after closing a dialog.', function() {
+ // The document body has the focus first
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY')
+
+ // Click on edit button
+ cy.get('#mobile-edit-button').click();
+
+ // Open comment insertion dialog
+ cy.get('#tb_actionbar_item_insertcomment')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ cy.get('.loleaflet-annotation-table').should('be.visible');
+
+ // The dialog grabs the focus
+ cy.document().its('activeElement.className')
+ .should('be.eq', 'loleaflet-annotation-textarea')
+
+ // Close the dialog
+ cy.contains('Cancel').click();
+ cy.get('.loleaflet-annotation-table').should('be.not.visible');
+
+ // The document should have the focus again
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY')
+ })
+
+ it('Focus when using insertion mobile wizard.', function() {
+ // The document body has the focus first
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY')
+
+ // Click on edit button
+ cy.get('#mobile-edit-button').click();
+
+ // Open insertion mobile wizard
+ cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ cy.get('#mobile-wizard-content')
+ .should('not.be.empty');
+
+ // This fails here: the document still has the focus
+ // The wizard changes the focus
+ //cy.document().its('activeElement.className')
+ // .should('be.eq', 'clipboard')
+
+ // Close the mobile wizard
+ cy.get('#tb_actionbar_item_insertion_mobile_wizard').click()
+ cy.get('#mobile-wizard').should('not.be.visible');
+
+ // This fails here: the focus is not on the document body
+ // The document should have the focus again
+ //cy.document().its('activeElement.tagName')
+ // .should('be.eq', 'BODY')
+ })
+
+ it('Focus after insertion.', function() {
+ // The document body has the focus first
+ cy.document().its('activeElement.tagName')
+ .should('be.eq', 'BODY')
+
+ // Click on edit button
+ cy.get('#mobile-edit-button').click();
+
+ // Open insertion mobile wizard
+ cy.get('#tb_actionbar_item_insertion_mobile_wizard')
+ .should('not.have.class', 'disabled')
+ .click();
+
+ cy.get('#mobile-wizard-content')
+ .should('not.be.empty')
+
+ // Select More Fields
+ cy.get('.ui-header.level-0.mobile-wizard.ui-widget .sub-menu-title')
+ .contains('More Fields...')
+ .parent().click();
+
+ // Insert a field
+ cy.get('.ui-header.level-1.mobile-wizard.ui-widget .menu-entry-with-icon')
+ .contains('Page Number').click();
+ cy.get('#mobile_wizard').should('not.be.visible');
+
+ // This fails here: the focus is not on the document body
+ // The document should have the focus again
+ //cy.document().its('activeElement.tagName')
+ // .should('be.eq', 'BODY')
+ })
+})
More information about the Libreoffice-commits
mailing list