Merge remote-tracking branch 'origin/master'

This commit is contained in:
Hosted Weblate 2021-11-10 20:24:25 +01:00
commit 00cc838b15
No known key found for this signature in database
GPG Key ID: A3FAAA06E6569B4C
7 changed files with 199 additions and 4 deletions

View File

@ -0,0 +1,56 @@
describe(__filename, function () {
it('Ensure cells are blanked down', function () {
const fixture = [
['a', 'b', 'c'],
['0a', 'identical', '0c'],
['1a', 'identical', '1c'],
['2a', '2b', '2c'],
['3a', 'also identical', '3c'],
['4a', 'also identical', '4c'],
['5a', 'also identical', '5c'],
];
cy.loadAndVisitProject(fixture);
//Create Pending Sort
cy.columnActionClick('b', ['Sort']);
cy.waitForDialogPanel();
cy.confirmDialogPanel();
//Verify Sort occurred
cy.assertCellEquals(0, 'b', '2b');
cy.assertCellEquals(1, 'b', 'also identical');
cy.assertCellEquals(2, 'b', 'also identical');
cy.assertCellEquals(3, 'b', 'also identical');
cy.assertCellEquals(4, 'b', 'identical');
cy.assertCellEquals(5, 'b', 'identical');
// click, then cancel dialog window
cy.columnActionClick('b', ['Edit cells', 'Blank down']);
cy.waitForDialogPanel();
cy.cancelDialogPanel();
//Verify blank down did not occur
cy.assertCellEquals(0, 'b', '2b');
cy.assertCellEquals(1, 'b', 'also identical');
cy.assertCellEquals(2, 'b', 'also identical');
cy.assertCellEquals(3, 'b', 'also identical');
cy.assertCellEquals(4, 'b', 'identical');
cy.assertCellEquals(5, 'b', 'identical');
// click, then confirm dialog window
cy.columnActionClick('b', ['Edit cells', 'Blank down']);
cy.waitForDialogPanel();
cy.confirmDialogPanel();
// ensure notification and cell content
cy.assertNotificationContainingText('Blank down 3 cells');
cy.assertCellEquals(0, 'b', '2b');
cy.assertCellEquals(1, 'b', 'also identical');
cy.assertCellEquals(2, 'b', 'identical');
cy.assertCellEquals(3, 'b', null);
cy.assertCellEquals(4, 'b', null);
cy.assertCellEquals(5, 'b', null);
});
});

View File

@ -0,0 +1,56 @@
describe(__filename, function () {
it('Ensure cells are filled down', function () {
const fixture = [
['a', 'b', 'c'],
['0a', '0b', '0c'],
['1a', null, '1c'],
['2a', '2b', '2c'],
['3a', null, '3c'],
['4a', null, '4c'],
['5a', '5b', '5c'],
];
cy.loadAndVisitProject(fixture);
//Create Pending Sort
cy.columnActionClick('b', ['Sort']);
cy.waitForDialogPanel();
cy.confirmDialogPanel();
//Verify Sort occurred
cy.assertCellEquals(0, 'b', '0b');
cy.assertCellEquals(1, 'b', '2b');
cy.assertCellEquals(2, 'b', '5b');
cy.assertCellEquals(3, 'b', null);
cy.assertCellEquals(4, 'b', null);
cy.assertCellEquals(5, 'b', null);
// click, then cancel dialog
cy.columnActionClick('b', ['Edit cells', 'Fill down']);
cy.waitForDialogPanel();
cy.cancelDialogPanel();
//Verify fill down did not occur
cy.assertCellEquals(0, 'b', '0b');
cy.assertCellEquals(1, 'b', '2b');
cy.assertCellEquals(2, 'b', '5b');
cy.assertCellEquals(3, 'b', null);
cy.assertCellEquals(4, 'b', null);
cy.assertCellEquals(5, 'b', null);
// click, then confirm dialog
cy.columnActionClick('b', ['Edit cells', 'Fill down']);
cy.waitForDialogPanel();
cy.confirmDialogPanel();
// ensure notification and cell content
cy.assertNotificationContainingText('Fill down 3 cells in column b');
cy.assertCellEquals(0, 'b', '0b'); // untouched
cy.assertCellEquals(1, 'b', '0b'); // filled
cy.assertCellEquals(2, 'b', '2b'); // untouched
cy.assertCellEquals(3, 'b', '2b'); // filled
cy.assertCellEquals(4, 'b', '2b'); // filled
cy.assertCellEquals(5, 'b', '5b'); // untouched
});
});

View File

@ -307,6 +307,16 @@ Cypress.Commands.add('confirmDialogPanel', () => {
cy.get('body > .dialog-container > .dialog-frame').should('not.exist');
});
/**
* Click on the Cancel button of a dialog panel
*/
Cypress.Commands.add('cancelDialogPanel', () => {
cy.get(
'body > .dialog-container > .dialog-frame .dialog-footer button[bind="cancelButton"]'
).click();
cy.get('body > .dialog-container > .dialog-frame').should('not.exist');
});
/**
* Will click on a menu entry for a given column name
*/

View File

@ -453,6 +453,8 @@
"core-views/remove-sort": "Remove sort",
"core-views/sort-by": "Sort by",
"core-views/sort-cell": "Sort cell values as",
"core-views/warn-of-pending-sort": "There is a sort pending. The data visible on screen may not reflect the data this operation will act on.",
"core-views/warning": "Warning",
"core-views/pos-blank": "Position blanks and errors",
"core-views/text": "text",
"core-views/case-sensitive": "case-sensitive",

View File

@ -910,12 +910,26 @@ DataTableView.prototype._createMenuForAllColumns = function(elmt) {
{
label: $.i18n('core-views/fill-down'),
id: "core/fill-down",
click: doAllFillDown
click: function () {
if (self._getSortingCriteriaCount() > 0) {
self._createPendingSortWarningDialog(doAllFillDown);
}
else {
doAllFillDown();
}
}
},
{
label: $.i18n('core-views/blank-down'),
id: "core/blank-down",
click: doAllBlankDown
click: function () {
if (self._getSortingCriteriaCount() > 0) {
self._createPendingSortWarningDialog(doAllBlankDown);
}
else {
doAllBlankDown();
}
}
}
]
},
@ -1117,3 +1131,29 @@ DataTableView.promptExpressionOnVisibleRows = function(column, title, expression
onDone
);
};
//This function takes a function as a parameter and creates a dialog window
//If the ok button is pressed, the function is executed
//If the cancel button is pressed instead, the window is dismissed and the function is not executed
DataTableView.prototype._createPendingSortWarningDialog = function(func) {
var frame = $(DOM.loadHTML("core", "scripts/views/data-table/warn-of-pending-sort.html"));
var elmts = DOM.bind(frame);
elmts.or_views_warning.text($.i18n('core-views/warn-of-pending-sort'));
elmts.dialogHeader.text($.i18n('core-views/warning'));
elmts.okButton.html($.i18n('core-buttons/ok'));
elmts.cancelButton.text($.i18n('core-buttons/cancel'));
var level = DialogSystem.showDialog(frame);
var dismiss = function() { DialogSystem.dismissLevel(level - 1); };
elmts.cancelButton.click( function () {
dismiss();
});
elmts.okButton.click( function () {
func();
dismiss();
});
};

View File

@ -468,12 +468,26 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
{
id: "core/fill-down",
label: $.i18n('core-views/fill-down'),
click: doFillDown
click: function () {
if (columnHeaderUI._dataTableView._getSortingCriteriaCount() > 0) {
columnHeaderUI._dataTableView._createPendingSortWarningDialog(doFillDown);
}
else {
doFillDown();
}
}
},
{
id: "core/blank-down",
label: $.i18n('core-views/blank-down'),
click: doBlankDown
click: function () {
if (columnHeaderUI._dataTableView._getSortingCriteriaCount() > 0) {
columnHeaderUI._dataTableView._createPendingSortWarningDialog(doBlankDown);
}
else {
doBlankDown();
}
}
},
{},
{

View File

@ -0,0 +1,17 @@
<div class="dialog-frame" style="min-width: 600px;">
<div class="dialog-border">
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">
<div class="grid-layout layout-tight layout-full"><table>
<tr>
<td><span bind="or_views_warning"></span></td>
</tr>
</table>
</div>
</div>
<div class="dialog-footer" bind="dialogFooter">
<button class="button" bind="okButton"></button>
<button class="button" bind="cancelButton"></button>
</div>
</div>
</div>