\
@@ -36,7 +38,6 @@ const moduleConfig = {
GestureEmitter.touchBoundary(GestureEmitter.initialTouchBoundary);
-
QUnit.module('events unsubscribing', {
beforeEach: function() {
@@ -281,134 +282,6 @@ QUnit.test('minimum distance for gesture should be 10 pixels', function(assert)
assert.ok(scrollStarted, 'scroll started');
});
-const GESTURE_COVER_CLASS = 'dx-gesture-cover';
-const $gestureCover = $('.' + GESTURE_COVER_CLASS);
-
-const gestureCoverExists = function() {
- return devices.real().deviceType === 'desktop' && $gestureCover.css('pointerEvents') !== undefined;
-};
-
-QUnit.test('wheel should be prevented on gesture cover (T319068)', function(assert) {
- if(!gestureCoverExists()) {
- assert.expect(0);
- return;
- }
-
- const event = $.Event('dxmousewheel');
- $('.' + GESTURE_COVER_CLASS).trigger(event);
- assert.equal(event.isDefaultPrevented(), true, 'scroll prevented');
-});
-
-QUnit.test('selection shouldn\'t be prevented in native scroll', function(assert) {
- if(!gestureCoverExists()) {
- assert.expect(0);
- return;
- }
-
- const $element = $('#element');
- const pointer = pointerMock($element);
-
- $element.on('dxscrollstart', { isNative: true }, $.noop);
-
- pointer.start().down().move(20);
- assert.equal($gestureCover.css('pointerEvents'), 'none', 'gestureCover is disabled');
-});
-
-$.each([
- ['hover', 'pointer-events', 'all', true],
- ['cursor', 'cursor', 'move', false]
-], function(_, config) {
- const name = config[0];
- const prop = config[1];
- const propValue = config[2];
- const needReset = config[3];
-
- if(!gestureCoverExists()) {
- return;
- }
-
- QUnit.test('gesture should set ' + name + ' if needed with pointer', function(assert) {
- assert.expect(2);
-
- const originalProp = $gestureCover.css(prop);
- const $element = $('#element');
- const pointer = pointerMock($element);
-
- $element.on({
- 'dxscrollstart': function(e) {
- assert.equal($gestureCover.css(prop), propValue, name + ' is disabled');
- },
- 'dxscrollend': function() {
- assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
- }
- });
-
- pointer.start().down().move(20).up();
- });
-
- QUnit.test('gesture should set ' + name + ' if needed with mousewheel', function(assert) {
- assert.expect(2);
-
- const originalProp = $gestureCover.css(prop);
- const $element = $('#element');
- const pointer = pointerMock($element);
-
- $element.on({
- 'dxscrollstart': function(e) {
- assert.equal($gestureCover.css(prop), propValue, name + ' is disabled');
- },
- 'dxscrollend': function() {
- assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
- }
- });
-
- pointer.start().wheel(20);
- });
-
- QUnit.test('cancel gesture should reset ' + name + ' on desktop', function(assert) {
- const originalProp = $gestureCover.css(prop);
- const $element = $('#element');
- const pointer = pointerMock($element);
-
- $element.on({
- 'dxscrollstart': function(e) {
- e.cancel = true;
- }
- });
-
- pointer.start().down().move(20).up();
- assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
- });
-
- QUnit.test('dispose gesture should reset ' + name + ' if locked by current emitter', function(assert) {
- const originalProp = $gestureCover.css(prop);
- const $element = $('#element');
- const pointer = pointerMock($element);
-
- $element.on({
- 'dxscrollstart.TEST': noop
- });
-
- pointer.start().down().move(20);
- $element.off('.TEST');
- assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
- });
-
- QUnit.test('dispose gesture should not reset ' + name + ' if locked by another emitter', function(assert) {
- const $child = $('#child');
- const $parent = $('#parent');
- const pointer = pointerMock($child);
-
- $child.on('dxscrollstart', noop);
- $parent.on('dxscrollstart.TEST', noop);
-
- pointer.start().down().move(20);
- const assignedProp = $gestureCover.css(prop);
- $parent.off('.TEST');
- assert.equal($gestureCover.css(prop), assignedProp, name + ' is enabled');
- });
-});
-
QUnit.test('gesture should be canceled if event should be skipped', function(assert) {
assert.expect(1);
@@ -1129,3 +1002,130 @@ QUnit.test('active emitter should not be reset if inactive emitter was unsubscri
pointer.up();
});
+
+QUnit.module('gesture cover', {
+ before: function() {
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on('dxscrollstart', noop);
+ pointer.start().down().move(20).up();
+ $element.off('dxscrollstart');
+ }
+}, function() {
+ const getGestureCover = () => $(`.${GESTURE_COVER_CLASS}`);
+
+ if(devices.real().deviceType === 'desktop') {
+ QUnit.test('wheel should be prevented on gesture cover (T319068)', function(assert) {
+ const event = $.Event('dxmousewheel');
+ getGestureCover().trigger(event);
+ assert.equal(event.isDefaultPrevented(), true, 'scroll prevented');
+ });
+
+ QUnit.test('selection shouldn\'t be prevented in native scroll', function(assert) {
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on('dxscrollstart', { isNative: true }, noop);
+
+ pointer.start().down().move(20);
+ assert.equal(getGestureCover().css('pointerEvents'), 'none', 'gestureCover is disabled');
+ });
+
+ $.each([
+ ['hover', 'pointer-events', 'all', true],
+ ['cursor', 'cursor', 'move', false]
+ ], function(_, config) {
+ const name = config[0];
+ const prop = config[1];
+ const propValue = config[2];
+ const needReset = config[3];
+
+ QUnit.test('gesture should set ' + name + ' if needed with pointer', function(assert) {
+ assert.expect(2);
+
+ const $gestureCover = getGestureCover();
+ const originalProp = $gestureCover.css(prop);
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on({
+ 'dxscrollstart': function(e) {
+ assert.equal($gestureCover.css(prop), propValue, name + ' is disabled');
+ },
+ 'dxscrollend': function() {
+ assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
+ }
+ });
+
+ pointer.start().down().move(20).up();
+ });
+
+ QUnit.test('gesture should set ' + name + ' if needed with mousewheel', function(assert) {
+ assert.expect(2);
+
+ const $gestureCover = getGestureCover();
+ const originalProp = $gestureCover.css(prop);
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on({
+ 'dxscrollstart': function(e) {
+ assert.equal($gestureCover.css(prop), propValue, name + ' is disabled');
+ },
+ 'dxscrollend': function() {
+ assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
+ }
+ });
+
+ pointer.start().wheel(20);
+ });
+
+ QUnit.test('cancel gesture should reset ' + name + ' on desktop', function(assert) {
+ const $gestureCover = getGestureCover();
+ const originalProp = $gestureCover.css(prop);
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on({
+ 'dxscrollstart': function(e) {
+ e.cancel = true;
+ }
+ });
+
+ pointer.start().down().move(20).up();
+ assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
+ });
+
+ QUnit.test('dispose gesture should reset ' + name + ' if locked by current emitter', function(assert) {
+ const $gestureCover = getGestureCover();
+ const originalProp = $gestureCover.css(prop);
+ const $element = $('#element');
+ const pointer = pointerMock($element);
+
+ $element.on({
+ 'dxscrollstart.TEST': noop
+ });
+
+ pointer.start().down().move(20);
+ $element.off('.TEST');
+ assert.equal($gestureCover.css(prop), needReset ? originalProp : propValue, name + ' is enabled');
+ });
+
+ QUnit.test('dispose gesture should not reset ' + name + ' if locked by another emitter', function(assert) {
+ const $gestureCover = getGestureCover();
+ const $child = $('#child');
+ const $parent = $('#parent');
+ const pointer = pointerMock($child);
+
+ $child.on('dxscrollstart', noop);
+ $parent.on('dxscrollstart.TEST', noop);
+
+ pointer.start().down().move(20);
+ const assignedProp = $gestureCover.css(prop);
+ $parent.off('.TEST');
+ assert.equal($gestureCover.css(prop), assignedProp, name + ' is enabled');
+ });
+ });
+ }
+});
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
index f5131fa0cbd7..4b144922a8ea 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/adaptiveColumns.tests.js
@@ -486,7 +486,7 @@ QUnit.test('Show the form when an adaptive row is expanded', function(assert) {
// assert
const form = $('.dx-master-detail-row .dx-form').dxForm('instance');
- assert.ok(form !== undefined, 'form is initialized');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
assert.equal(form.option('items')[0].column.dataField, 'lastName', 'dataField of column');
assert.equal(form.option('items')[0].dataField, 'lastName', 'dataField of item');
assert.equal($('.dx-field-item-content').text(), 'Psy', 'text of item');
@@ -771,7 +771,7 @@ QUnit.test('Show the form with cellTemplate when an adaptive row is expanded', f
// assert
const form = $('.dx-master-detail-row .dx-form').dxForm('instance');
- assert.ok(form !== undefined, 'form is initialized');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
assert.equal(form.option('items')[0].column.dataField, 'lastName', 'dataField of column');
assert.equal(form.option('items')[0].dataField, 'lastName', 'dataField of item');
assert.equal($('.dx-field-item-content').text(), 'Psy template', 'template text of item');
@@ -1823,6 +1823,44 @@ QUnit.test('The adaptive cell should be empty in a grouped row with a summary',
assert.strictEqual($(this.rowsView.getRowElement(0)).children('.dx-command-adaptive').html(), ' ', 'adaptive cell');
});
+// T857506
+QUnit.test('The group cell content should not be hidden when the hidingPriority property is specified for a first column', function(assert) {
+ // arrange, act
+ $('.dx-datagrid').width(400);
+ this.items = [
+ { firstName: 'Blablablablablablablablablabla', lastName: 'Psy', sex: true },
+ { firstName: 'Super', lastName: 'Star', sex: false }
+ ];
+ this.options = {
+ columns: [
+ { dataField: 'firstName', hidingPriority: 1 },
+ { dataField: 'lastName', groupIndex: 0 },
+ { dataField: 'sex' }
+ ],
+ grouping: {
+ autoExpandAll: true
+ }
+ };
+ setupDataGrid(this);
+ this.rowsView.render($('#container'));
+ this.resizingController.updateDimensions();
+
+ // assert
+ let $rowElement = $(this.getRowElement(0));
+ let $cellElements = $rowElement.children();
+
+ assert.ok($rowElement.hasClass('dx-group-row'), 'group row');
+ assert.ok($cellElements.eq(1).hasClass('dx-group-cell'), 'group cell');
+ assert.notOk($cellElements.eq(1).hasClass('dx-datagrid-hidden-column'), 'group cell content is visible');
+
+ $rowElement = $(this.getRowElement(1));
+ $cellElements = $rowElement.children();
+
+ assert.ok($rowElement.hasClass('dx-data-row'), 'data row');
+ assert.ok($cellElements.eq(1).hasClass('dx-datagrid-hidden-column'), 'firstName column is hidden');
+});
+
+
QUnit.module('API', {
beforeEach: function() {
this.clock = sinon.useFakeTimers();
@@ -2033,7 +2071,7 @@ QUnit.test('Hide the adaptive and master detail row', function(assert) {
// assert
assert.equal($rows.length, 1, 'master detail rows count');
- assert.ok($rows.eq(0).css('display') === 'none', 'master detail row');
+ assert.strictEqual($rows.eq(0).css('display'), 'none', 'master detail row');
});
QUnit.test('Expand adaptive row when row as tbody', function(assert) {
@@ -2099,13 +2137,13 @@ QUnit.test('Edit form. Check that adaptive form is hidden', function(assert) {
this.clock.tick();
let adaptiveDetailForm = $('.dx-adaptive-detail-row .dx-form').dxForm('instance');
- assert.ok(adaptiveDetailForm !== undefined, 'adaptive detail form is initialized');
+ assert.notStrictEqual(adaptiveDetailForm, undefined, 'adaptive detail form is initialized');
this.editingController.editRow(0);
this.clock.tick();
adaptiveDetailForm = $('.dx-adaptive-detail-row .dx-form').dxForm('instance');
- assert.ok(adaptiveDetailForm === undefined, 'adaptive detail form is not initialized');
+ assert.strictEqual(adaptiveDetailForm, undefined, 'adaptive detail form is not initialized');
});
// T458653
@@ -2213,9 +2251,9 @@ QUnit.test('Edit row', function(assert) {
const editor1 = $editors.eq(0).dxTextBox('instance');
const editor2 = $editors.eq(2).dxTextBox('instance');
- assert.ok(form !== undefined, 'form is initialized');
- assert.equal($editors.length, 3, 'editors count');
- assert.equal(editor2.option('value'), 'Psy', 'editor\'s value');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
+ assert.strictEqual($editors.length, 3, 'editors count');
+ assert.strictEqual(editor2.option('value'), 'Psy', 'editor\'s value');
// act
editor1.option('value', 'Man');
@@ -2226,7 +2264,7 @@ QUnit.test('Edit row', function(assert) {
form = $('.dx-master-detail-row .dx-form').dxForm('instance');
$editors = $('.dx-texteditor');
- assert.ok(form === undefined, 'form is not initialized');
+ assert.strictEqual(form, undefined, 'form is not initialized');
assert.equal($editors.length, 0, 'editors count');
assert.equal($('.dx-editor-cell').length, 0, 'the editor cell class is not applied');
});
@@ -2338,7 +2376,7 @@ QUnit.test('Edit row. Check repeat edit', function(assert) {
form = $('.dx-master-detail-row .dx-form').dxForm('instance');
$editors = $('.dx-texteditor');
- assert.ok(form !== undefined, 'form is initialized');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
assert.equal($editors.length, 3, 'editors count');
});
@@ -2403,7 +2441,7 @@ QUnit.test('Edit row. Editor is not rendered inside the form widget when clicked
$($itemContent).trigger('dxclick');
// assert
- assert.ok(form !== undefined, 'form is initialized');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
assert.equal($('.dx-texteditor').length, 0, 'editors count');
});
@@ -2513,7 +2551,7 @@ QUnit.test('Edit row. Editors are rendered inside the form widget when the adapt
const form = $('.dx-master-detail-row .dx-form').dxForm('instance');
// assert
- assert.ok(form !== undefined, 'form is initialized');
+ assert.notStrictEqual(form, undefined, 'form is initialized');
assert.equal($('.dx-texteditor').length, 3, 'editors count');
});
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/columnsResizingReorderingModule.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/columnsResizingReorderingModule.tests.js
index d47003cd68f5..84630dd5e585 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/columnsResizingReorderingModule.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/columnsResizingReorderingModule.tests.js
@@ -1474,7 +1474,7 @@ function getEvent(options) {
}));
// assert
- assert.ok(resizeController._columnsController.updateOptions.length === 0, 'cancel moving');
+ assert.strictEqual(resizeController._columnsController.updateOptions.length, 0, 'cancel moving');
});
QUnit.test('Headers element is null in startResizing_B239012', function(assert) {
@@ -1560,7 +1560,7 @@ function getEvent(options) {
this.renderViews($container);
// assert
- assert.ok($container.find('.dx-datagrid-columns-separator').length === 0, 'columnsSeparator is null');
+ assert.strictEqual($container.find('.dx-datagrid-columns-separator').length, 0, 'columnsSeparator is null');
});
QUnit.test('Update height of separator when caption of header is wrapped', function(assert) {
@@ -2323,7 +2323,7 @@ function getEvent(options) {
// assert
assert.ok(isPointsUpdated, 'points by columns is updated');
assert.ok(!resizeController._columnsSeparatorView._isShown, 'columnsSeparator is hidden');
- assert.ok(resizeController._columnsSeparatorView._testCursorName === '', 'cursor is down');
+ assert.strictEqual(resizeController._columnsSeparatorView._testCursorName, '', 'cursor is down');
assert.ok(!resizeController._isResizing, 'columnsResizer is not resized');
assert.ok(!resizeController._isReadyResizing, 'columnsResizer is not ready resized');
});
@@ -3360,7 +3360,7 @@ function getEvent(options) {
$draggingHeader = testElement.find('.dx-datagrid-drag-header');
// assert
- assert.ok($draggingHeader.length === 1, 'draggingHeader element');
+ assert.strictEqual($draggingHeader.length, 1, 'draggingHeader element');
assert.strictEqual($draggingHeader.css('display'), 'none', 'display is none');
assert.ok($draggingHeader.hasClass('dx-widget'), 'Widget class');
});
@@ -3384,7 +3384,7 @@ function getEvent(options) {
$draggingHeader = testElement.find('.dx-datagrid-drag-header');
// assert
- assert.ok($draggingHeader.length === 1, 'draggingHeader element');
+ assert.strictEqual($draggingHeader.length, 1, 'draggingHeader element');
assert.strictEqual($draggingHeader.css('display'), 'none', 'display is none');
});
@@ -3407,7 +3407,7 @@ function getEvent(options) {
$draggingHeader = testElement.find('.dx-datagrid-drag-header');
// assert
- assert.ok($draggingHeader.length === 1, 'draggingHeader element');
+ assert.strictEqual($draggingHeader.length, 1, 'draggingHeader element');
assert.strictEqual($draggingHeader.css('display'), 'none', 'display is none');
});
@@ -4523,15 +4523,15 @@ function getEvent(options) {
// assert
assert.equal(moveHeaderDataSelfArgs.length, 1);
- assert.ok(moveHeaderDataSelfArgs[0] === controller1._draggingHeaderView);
+ assert.strictEqual(moveHeaderDataSelfArgs[0], controller1._draggingHeaderView);
// act
$(controller2._columnHeadersView.element().find('td').first()).trigger(dragEvents.move + '.dxDataGridResizingReordering');
// assert
assert.equal(moveHeaderDataSelfArgs.length, 2);
- assert.ok(moveHeaderDataSelfArgs[0] === controller1._draggingHeaderView);
- assert.ok(moveHeaderDataSelfArgs[1] === controller2._draggingHeaderView);
+ assert.strictEqual(moveHeaderDataSelfArgs[0], controller1._draggingHeaderView);
+ assert.strictEqual(moveHeaderDataSelfArgs[1], controller2._draggingHeaderView);
});
QUnit.test('setRowsOpacity method of views should called only once for begin dragging', function(assert) {
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.export.customizeExcelCell.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.export.customizeExcelCell.tests.js
index d1b6a87c814a..ccb52b2a4680 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.export.customizeExcelCell.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.export.customizeExcelCell.tests.js
@@ -24,7 +24,7 @@ QUnit.test('Check e.component', function(assert) {
export: {
customizeExcelCell: e => {
assert.ok(isDefined(onCellPreparedComponent));
- assert.ok(e.component === onCellPreparedComponent);
+ assert.strictEqual(e.component, onCellPreparedComponent);
}
},
}
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js
index 7fe7096029e0..1570a3c878fe 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/dataGrid.tests.js
@@ -75,6 +75,9 @@ import ajaxMock from '../../helpers/ajaxMock.js';
import themes from 'ui/themes';
import DataGridWrapper from '../../helpers/wrappers/dataGridWrappers.js';
import { checkDxFontIcon, DX_ICON_XLSX_FILE_CONTENT_CODE, DX_ICON_EXPORT_SELECTED_CONTENT_CODE } from '../../helpers/checkDxFontIconHelper.js';
+import 'ui/scroll_view';
+import { CLICK_EVENT } from '../../helpers/grid/keyboardNavigationHelper.js';
+
const DX_STATE_HOVER_CLASS = 'dx-state-hover';
const TEXTEDITOR_INPUT_SELECTOR = '.dx-texteditor-input';
@@ -3819,7 +3822,7 @@ QUnit.test('Horizontal scrollbar is not displayed when columns width has float v
const dataGrid = $dataGrid.dxDataGrid('instance');
// assert
- assert.ok(dataGrid.getView('rowsView').getScrollbarWidth(true) === 0);
+ assert.strictEqual(dataGrid.getView('rowsView').getScrollbarWidth(true), 0);
});
// T386755
@@ -4452,16 +4455,14 @@ QUnit.test('Cell should not be unfocused after click on it while editing with ro
QUnit.test('onFocusedCellChanged event should contains correct row object if scrolling, rowRenderingMode are virtual', function(assert) {
// arrange
const data = [];
- let dataGrid;
let focusedCellChangedCount = 0;
- let scrollable;
for(let i = 0; i < 50; i++) {
data.push({ id: i + 1 });
}
// arrange
- dataGrid = $('#dataGrid').dxDataGrid({
+ const dataGrid = $('#dataGrid').dxDataGrid({
height: 150,
keyExpr: 'id',
dataSource: data,
@@ -4484,11 +4485,11 @@ QUnit.test('onFocusedCellChanged event should contains correct row object if scr
this.clock.tick();
// act
- scrollable = dataGrid.getScrollable();
+ const scrollable = dataGrid.getScrollable();
scrollable.scrollTo({ y: 600 });
$(scrollable._container()).trigger('scroll');
this.clock.tick();
- $(dataGrid.getCellElement(0, 0)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(0, 0)).trigger(CLICK_EVENT);
this.clock.tick();
// assert
@@ -4554,9 +4555,9 @@ QUnit.test('Row should be focused after click on readonly cell if editor is open
}).dxDataGrid('instance');
// act
- $(dataGrid.getCellElement(0, 1)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(0, 1)).trigger(CLICK_EVENT);
dataGrid.editCell(0, 1);
- $(dataGrid.getCellElement(1, 0)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(1, 0)).trigger(CLICK_EVENT);
// assert
assert.equal(dataGrid.option('focusedRowIndex'), 1, 'focusedRowIndex');
@@ -4636,7 +4637,6 @@ QUnit.test('focusedRowKey should not overwrite dataSource field', function(asser
QUnit.test('DataGrid should not scroll back to the focusedRow after paging if virtual scrolling (T718905, T719205)', function(assert) {
// arrange
- let isReady;
const data = [
{ name: 'Alex', phone: '111111', room: 6 },
{ name: 'Dan', phone: '2222222', room: 5 },
@@ -4652,18 +4652,14 @@ QUnit.test('DataGrid should not scroll back to the focusedRow after paging if vi
focusedRowEnabled: true,
focusedRowIndex: 0,
scrolling: { mode: 'virtual' },
- paging: { pageSize: 2 },
- onContentReady: function(e) {
- if(!isReady) {
- // act
- e.component.pageIndex(1);
- isReady = true;
- }
- }
+ paging: { pageSize: 2 }
}).dxDataGrid('instance');
this.clock.tick();
+ dataGrid.pageIndex(1);
+ this.clock.tick();
+
// assert
assert.equal(dataGrid.pageIndex(), 1, 'pageIndex');
});
@@ -4948,6 +4944,98 @@ QUnit.testInActiveWindow('Data cell in group column with showWhenGrouped=true sh
assert.deepEqual(keyboardController._focusedCellPosition, { rowIndex: 1, columnIndex: 3 }, 'focused cell position');
});
+// T859208
+QUnit.test('Sort indicators should not be rendered if grouping is applied and showWhenGrouped = true (single sorting)', function(assert) {
+ // arrange
+ const dataGrid = $('#dataGrid').dxDataGrid({
+ dataSource: [{ }],
+ sorting: {
+ mode: 'single'
+ },
+ columns: [{
+ dataField: 'field1'
+ }, {
+ dataField: 'field3',
+ sortOrder: 'desc',
+ showWhenGrouped: true
+ }],
+ groupPanel: {
+ visible: true
+ }
+ }).dxDataGrid('instance');
+
+ this.clock.tick();
+
+ // act
+ dataGrid.columnOption(1, 'groupIndex', 0);
+ this.clock.tick();
+
+ // assert
+ const $dataGrid = $(dataGrid.$element());
+ const $headers = $dataGrid.find('.dx-header-row > td');
+ const $groupPanelItem = $dataGrid.find('.dx-group-panel-item');
+
+ assert.notOk($headers.eq(2).find('.dx-sort').length, 'no element with dx-sort class');
+ assert.notOk($headers.eq(2).find('.dx-sort-indicator').length, 'no element with dx-sort-indicator class');
+
+ assert.ok($groupPanelItem.find('.dx-sort').length, 'group item sort indicator');
+ assert.notOk($groupPanelItem.find('.dx-sort-indicator').length, 'no element with dx-sort-indicator class');
+});
+
+function groupingWithSortingTest(that, assert, sortIndexes) {
+ // arrange
+ const dataGrid = $('#dataGrid').dxDataGrid({
+ dataSource: [{ }],
+ sorting: {
+ mode: 'multiple'
+ },
+ columns: [{
+ dataField: 'field1',
+ sortOrder: 'desc',
+ sortIndex: sortIndexes[0]
+ }, {
+ dataField: 'field3',
+ sortOrder: 'desc',
+ sortIndex: sortIndexes[1],
+ showWhenGrouped: true
+ }],
+ groupPanel: {
+ visible: true
+ }
+ }).dxDataGrid('instance');
+
+ that.clock.tick();
+
+ // act
+ dataGrid.columnOption(1, 'groupIndex', 0);
+ that.clock.tick();
+
+ // assert
+ const $dataGrid = $(dataGrid.$element());
+ const $headers = $dataGrid.find('.dx-header-row > td');
+ const $groupPanelItem = $dataGrid.find('.dx-group-panel-item');
+
+ assert.notOk($headers.eq(2).find('.dx-sort').length, 'no element with dx-sort class');
+ assert.notOk($headers.eq(2).find('.dx-sort-indicator').length, 'no element with dx-sort-indicator class');
+ assert.notOk($headers.eq(2).find('.dx-sort-index-indicator').length, 'no element with dx-sort-index-indicator class');
+
+ assert.ok($groupPanelItem.find('.dx-sort').length, 'group item sort indicator');
+ assert.notOk($groupPanelItem.find('.dx-sort-indicator').length, 'no element with dx-sort-indicator class');
+ assert.notOk($groupPanelItem.find('.dx-sort-index-indicator').length, 'no element with dx-sort-index-indicator class');
+
+ assert.equal($headers.eq(1).find('.dx-sort-index-icon').text(), `${sortIndexes[0] + 1}`, 'has sort index icon');
+ assert.notOk($headers.eq(2).find('.dx-sort-index-icon').length, 'no sort index icon');
+ assert.notOk($groupPanelItem.find('.dx-sort-index-icon').length, 'no sort index icon');
+
+ dataGrid.dispose();
+}
+
+// T859208
+QUnit.test('Sort indicators should not be rendered if grouping is applied and showWhenGrouped = true (multiple sorting)', function(assert) {
+ groupingWithSortingTest(this, assert, [0, 1]);
+ groupingWithSortingTest(this, assert, [1, 0]);
+});
+
QUnit.test('Enable rows hover via option method', function(assert) {
if(devices.real().deviceType !== 'desktop') {
assert.ok(true, 'hover is disabled for not desktop devices');
@@ -5824,6 +5912,21 @@ QUnit.test('max-height from styles', function(assert) {
assert.ok($dataGrid.find('.dx-datagrid').height() < 400, 'height is less then max-height');
});
+// T849902
+QUnit.test('max-height as float number from styles', function(assert) {
+ // arrange, act
+ const dataGrid = $('#dataGrid').css('maxHeight', '100.2px').dxDataGrid({
+ loadingTimeout: undefined,
+ dataSource: [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}],
+ columns: ['field1']
+ }).dxDataGrid('instance');
+
+ // assert
+ const scrollable = dataGrid.getScrollable();
+ assert.ok(scrollable, 'scrollable is created');
+ assert.ok(scrollable.$content().height() > scrollable._container().height(), 'scroll is exists');
+});
+
// T820186
QUnit.test('width 100% should be applied if container width is zero on render', function(assert) {
// arrange
@@ -5937,7 +6040,7 @@ QUnit.test('native scrollBars layout should be correct after width change if fix
assert.ok(dataGrid.getView('rowsView').getScrollbarWidth() > 0, 'vertical scrollBar exists');
} else {
assert.equal($('#dataGrid').find('.dx-datagrid-content-fixed').eq(1).css('margin-right'), '0px', 'margin-right is zero');
- assert.ok(dataGrid.getView('rowsView').getScrollbarWidth() === 0, 'vertical scrollBar not exists');
+ assert.strictEqual(dataGrid.getView('rowsView').getScrollbarWidth(), 0, 'vertical scrollBar not exists');
}
assert.notEqual($('#dataGrid').find('.dx-datagrid-content-fixed').eq(1).css('margin-bottom'), '0px', 'margin-bottom is not zero');
});
@@ -7686,7 +7789,7 @@ QUnit.test('contentReady should not be raised on row click', function(assert) {
assert.equal(contentReadyCallCount, 1, 'one contentReady on start');
// act
- $(dataGrid.getCellElement(0, 0)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(0, 0)).trigger(CLICK_EVENT);
// assert
assert.ok(dataGrid);
@@ -7732,7 +7835,7 @@ QUnit.test('contentReady should not be raised on row click if focusedRowEnabled'
assert.equal(contentReadyCallCount, 1, 'one contentReady on start');
// act
- $(dataGrid.getCellElement(0, 0)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(0, 0)).trigger(CLICK_EVENT);
// assert
assert.ok(dataGrid);
@@ -7768,7 +7871,7 @@ QUnit.test('onFocusedRowChanged event should fire only once if paging and init p
assert.equal(focusedRowChangedCallCount, 1, 'focusedRowChangedCallCount');
});
-QUnit.test('onFocusedRowChanged event should not fire on init if focusedRowEnabled is true and focusedRowIndex, focusedRowKey aren\'t set', function(assert) {
+QUnit.test('onFocusedRowChanged event should not fire on init if focusedRowEnabled is true and focusedRowIndex, focusedRowKey are not set', function(assert) {
let focusedRowChangedCallCount = 0;
const dataGrid = createDataGrid({
onFocusedRowChanged: function() {
@@ -7785,7 +7888,7 @@ QUnit.test('onFocusedRowChanged event should not fire on init if focusedRowEnabl
assert.equal(focusedRowChangedCallCount, 0, 'focusedRowChangedCallCount');
// act
- $(dataGrid.getCellElement(0, 0)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(0, 0)).trigger(CLICK_EVENT);
// assert
assert.equal(focusedRowChangedCallCount, 1, 'focusedRowChangedCallCount');
});
@@ -7810,7 +7913,7 @@ QUnit.test('Click by the first row on the next page should focus it without grid
sinon.spy(dataSource, 'load');
// act
- $(dataGrid.getCellElement(2, 1)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(2, 1)).trigger(CLICK_EVENT);
// assert
assert.equal(dataGrid.option('focusedRowIndex'), 2, 'focusedRowIndex');
@@ -9043,6 +9146,47 @@ QUnit.test('Editor should be rendered for hidden columns while editing in row mo
});
});
+QUnit.test('Scrollable should have the correct padding when the grid inside the ScrollView', function(assert) {
+ // arrange, act
+ $('#container').dxScrollView({
+ showScrollbar: 'always'
+ });
+ const dataGrid = createDataGrid({
+ dataSource: [{ field1: 1 }],
+ columnAutoWidth: true,
+ scrolling: {
+ showScrollbar: 'always'
+ }
+ });
+ this.clock.tick(30);
+
+ // assert
+ const $scrollableContent = $(dataGrid.getScrollable().content());
+ assert.strictEqual($scrollableContent.css('paddingRight'), '0px', 'paddingRight');
+ assert.strictEqual($scrollableContent.css('paddingLeft'), '0px', 'paddingLeft');
+});
+
+QUnit.test('Scrollable should have the correct padding when the grid inside the ScrollView in RTL', function(assert) {
+ // arrange, act
+ $('#container').dxScrollView({
+ showScrollbar: 'always'
+ });
+ const dataGrid = createDataGrid({
+ dataSource: [{ field1: 1 }],
+ columnAutoWidth: true,
+ rtlEnabled: true,
+ scrolling: {
+ showScrollbar: 'always'
+ }
+ });
+ this.clock.tick(30);
+
+ // assert
+ const $scrollableContent = $(dataGrid.getScrollable().content());
+ assert.strictEqual($scrollableContent.css('paddingRight'), '0px', 'paddingRight');
+ assert.strictEqual($scrollableContent.css('paddingLeft'), '0px', 'paddingLeft');
+});
+
QUnit.module('Virtual row rendering', baseModuleConfig);
QUnit.test('editing should starts correctly if scrolling mode is virtual', function(assert) {
@@ -10020,6 +10164,51 @@ QUnit.test('cellTemplate should be rendered, asynchronously if column renderAsyn
assert.equal(cellTemplateArgs[0].column.dataField, 'template', 'cell template column');
});
+// T857205
+QUnit.test(' if renderAsync is true and state storing is used', function(assert) {
+ let selectedRowKeys = [1, 2];
+
+ const customLoad = sinon.spy(() => {
+ return {
+ selectedRowKeys: selectedRowKeys
+ };
+ });
+
+ // act
+ const grid = createDataGrid({
+ dataSource: [{ id: 1 }, { id: 2 }, { id: 3 }],
+ keyExpr: 'id',
+ loadingTimeout: undefined,
+ renderAsync: true,
+ filterRow: {
+ visible: true
+ },
+ selection: {
+ mode: 'multiple'
+ },
+ stateStoring: {
+ enabled: true,
+ type: 'custom',
+ customLoad
+ }
+ });
+
+ const $grid = grid.$element();
+ this.clock.tick();
+
+ const $selectCheckboxes = $grid.find('.dx-select-checkbox');
+ const $inputs = $selectCheckboxes.find('input');
+
+ // assert
+ assert.equal(customLoad.callCount, 1, 'customLoad was called once');
+
+ assert.deepEqual(grid.getSelectedRowKeys(), selectedRowKeys, 'selected row keys');
+
+ assert.equal($inputs.eq(1).prop('value'), 'true', 'first row checkbox');
+ assert.equal($inputs.eq(2).prop('value'), 'true', 'second row checkbox');
+ assert.equal($inputs.eq(3).prop('value'), 'false', 'third row checkbox');
+});
+
QUnit.module('Assign options', baseModuleConfig);
// B232542
@@ -11642,7 +11831,7 @@ QUnit.test('Reset last non-command column width when width 100% in style', funct
assert.equal($cols.length, 3);
assert.equal($cols.get(0).style.width, '50px', 'first column width is not reset');
assert.equal($cols.get(1).style.width, 'auto', 'second column width is reset - this is last non-command column');
- assert.ok($cols.get(2).style.width !== 'auto', 'command column width is not reset');
+ assert.notStrictEqual($cols.get(2).style.width, 'auto', 'command column width is not reset');
assert.equal($dataGrid.width(), $dataGrid.parent().width());
});
@@ -13882,7 +14071,7 @@ QUnit.test('Focused cell position has correct value when focus grouping row cell
};
// act
- $(dataGrid.getCellElement(2, 2)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(2, 2)).trigger(CLICK_EVENT);
assert.deepEqual(keyboardNavigationController._focusedCellPosition, {
columnIndex: 2,
@@ -13952,7 +14141,7 @@ QUnit.test('Focused cell position has correct value when focus grouping row with
};
// act
- $(dataGrid.getCellElement(1, 1)).trigger(pointerEvents.up);
+ $(dataGrid.getCellElement(1, 1)).trigger(CLICK_EVENT);
// assert
assert.deepEqual(keyboardNavigationController._focusedCellPosition, {
@@ -18359,6 +18548,38 @@ QUnit.testInActiveWindow('DataGrid - Master grid should not render it\'s overlay
assert.ok(detailRowsViewWrapper.isFocusOverlayVisible(), 'Detail grid focus overlay is visible');
});
+QUnit.testInActiveWindow('Not highlight cell if isHighlighted set false in the onFocusedCellChanging event by Tab key (T853599)', function(assert) {
+ // arrange
+ let focusedCellChangingCount = 0;
+ this.dataGrid.option({
+ dataSource: [{ name: 'Alex', phone: '111111', room: 6 }],
+ keyExpr: 'name',
+ onFocusedCellChanging: function(e) {
+ ++focusedCellChangingCount;
+ e.isHighlighted = false;
+ }
+ });
+ this.clock.tick();
+
+ $(this.dataGrid.getCellElement(0, 0))
+ .trigger(CLICK_EVENT)
+ .click();
+ this.clock.tick();
+
+ // assert
+ assert.equal(this.dataGrid.option('focusedRowIndex'), 0, 'focusedRowIndex');
+ assert.equal(this.dataGrid.option('focusedColumnIndex'), 0, 'focusedColumnIndex');
+
+ // act
+ const navigationController = this.dataGrid.getController('keyboardNavigation');
+ navigationController._keyDownHandler({ key: 'Tab', keyName: 'tab', originalEvent: $.Event('keydown', { target: $(this.dataGrid.getCellElement(0, 0)) }) });
+ this.clock.tick();
+
+ // assert
+ assert.equal(focusedCellChangingCount, 2, 'onFocusedCellChanging fires count');
+ assert.notOk($(this.dataGrid.getCellElement(0, 1)).hasClass('dx-focused'), 'cell is not focused');
+});
+
QUnit.test('Focus row element should support native DOM', function(assert) {
// arrange
let $focusedCell;
@@ -18723,7 +18944,7 @@ QUnit.test('The edited cell should be closed on click inside another dataGrid',
this.clock.tick(100);
// assert
- assert.ok($(dataGrid1.getCellElement(0, 0)).find('input').length === 0, 'hasn\'t input');
+ assert.strictEqual($(dataGrid1.getCellElement(0, 0)).find('input').length, 0, 'hasn\'t input');
assert.notOk($(dataGrid1.getCellElement(0, 0)).hasClass('dx-editor-cell'), 'cell of the first grid isn\'t editable');
assert.ok($(dataGrid2.getCellElement(0, 0)).find('input').length > 0, 'has input');
});
@@ -18791,7 +19012,7 @@ QUnit.test('onFocusedRowChanging, onFocusedRowChanged event if click selection c
});
// act
- rowsViewWrapper.getSelectionCheckBoxElement(1).trigger(pointerEvents.up);
+ rowsViewWrapper.getSelectionCheckBoxElement(1).trigger(CLICK_EVENT);
this.clock.tick();
// assert
@@ -18827,7 +19048,7 @@ QUnit.test('Cancel focused row if click selection checkBox (T812681)', function(
assert.equal(dataGrid.option('focusedRowIndex'), -1, 'focusedRowIndex');
// act
- rowsViewWrapper.getSelectionCheckBoxElement(1).trigger(pointerEvents.up);
+ rowsViewWrapper.getSelectionCheckBoxElement(1).trigger(CLICK_EVENT);
this.clock.tick();
// assert
@@ -18837,84 +19058,47 @@ QUnit.test('Cancel focused row if click selection checkBox (T812681)', function(
assert.equal(dataGrid.option('focusedRowIndex'), -1, 'focusedRowIndex');
});
-QUnit.test('DataGrid - Focus updating on refresh should be correct for focused row if editing mode is cell (T830334)', function(assert) {
- // arrange
- let counter = 0;
- const rowsViewWrapper = dataGridWrapper.rowsView;
- const dataGrid = createDataGrid({
- loadingTimeout: undefined,
- height: 100,
- dataSource: [
- { name: 'Alex', phone: '111111', room: 1 },
- { name: 'Dan', phone: '2222222', room: 2 },
- { name: 'Ben', phone: '333333', room: 3 },
- { name: 'Sean', phone: '4545454', room: 4 },
- { name: 'Smith', phone: '555555', room: 5 },
- { name: 'Zeb', phone: '6666666', room: 6 }
- ],
- editing: {
- mode: 'cell',
- allowUpdating: true
- },
- keyExpr: 'name',
- focusedRowEnabled: true
- });
- dataGrid.getView('rowsView').scrollToElementVertically = function($row) {
- ++counter;
- assert.equal($row.find('td').eq(0).text(), 'Zeb', 'Row');
- };
+['batch', 'cell'].forEach(editMode => {
+ QUnit.test(`DataGrid - Focus updating on refresh should be correct for focused row if ${editMode} edit mode (T830334)`, function(assert) {
+ // arrange
+ let counter = 0;
+ const rowsViewWrapper = dataGridWrapper.rowsView;
+ const dataGrid = createDataGrid({
+ loadingTimeout: undefined,
+ height: 100,
+ dataSource: [
+ { name: 'Alex', phone: '111111', room: 1 },
+ { name: 'Dan', phone: '2222222', room: 2 },
+ { name: 'Ben', phone: '333333', room: 3 },
+ { name: 'Sean', phone: '4545454', room: 4 },
+ { name: 'Smith', phone: '555555', room: 5 },
+ { name: 'Zeb', phone: '6666666', room: 6 }
+ ],
+ editing: {
+ mode: editMode,
+ allowUpdating: true
+ },
+ keyExpr: 'name',
+ focusedRowEnabled: true
+ });
- // act
- dataGrid.getScrollable().scrollBy({ y: 400 });
- $(dataGrid.getCellElement(5, 1))
- .trigger(pointerEvents.up)
- .trigger('dxclick');
+ dataGrid.getView('rowsView').scrollToElementVertically = function($row) {
+ ++counter;
+ assert.equal($row.find('td').eq(0).text(), 'Zeb', 'Row');
+ };
- // assert
- assert.ok(rowsViewWrapper.getEditorInput(5, 1).length, 'Cell[5, 1] is in editing mode');
- assert.ok(rowsViewWrapper.isFocusedRow(5), 'Row 5 is focused');
- assert.equal(counter, 2, 'scrollToElementVertically called twice');
-});
+ // act
+ dataGrid.getScrollable().scrollBy({ y: 400 });
+ $(dataGrid.getCellElement(5, 1))
+ .trigger(CLICK_EVENT)
+ .trigger('dxclick');
-QUnit.test('DataGrid - Focus updating on refresh should be correct for focused row if editing mode is batch (T830334)', function(assert) {
- // arrange
- let counter = 0;
- const rowsViewWrapper = dataGridWrapper.rowsView;
- const dataGrid = createDataGrid({
- loadingTimeout: undefined,
- height: 100,
- dataSource: [
- { name: 'Alex', phone: '111111', room: 1 },
- { name: 'Dan', phone: '2222222', room: 2 },
- { name: 'Ben', phone: '333333', room: 3 },
- { name: 'Sean', phone: '4545454', room: 4 },
- { name: 'Smith', phone: '555555', room: 5 },
- { name: 'Zeb', phone: '6666666', room: 6 }
- ],
- editing: {
- mode: 'batch',
- allowUpdating: true
- },
- keyExpr: 'name',
- focusedRowEnabled: true
+ // assert
+ assert.ok(rowsViewWrapper.getEditorInput(5, 1).length, 'Cell[5, 1] is in editing mode');
+ assert.ok(rowsViewWrapper.isFocusedRow(5), 'Row 5 is focused');
+ assert.equal(counter, 2, 'scrollToElementVertically called twice');
});
-
- dataGrid.getView('rowsView').scrollToElementVertically = function($row) {
- ++counter;
- assert.equal($row.find('td').eq(0).text(), 'Zeb', 'Row');
- };
-
- // act
- dataGrid.getScrollable().scrollBy({ y: 400 });
- $(dataGrid.getCellElement(5, 1))
- .trigger(pointerEvents.up)
- .trigger('dxclick');
-
- // assert
- assert.ok(rowsViewWrapper.getEditorInput(5, 1).length, 'Cell[5, 1] is in editing mode');
- assert.ok(rowsViewWrapper.isFocusedRow(5), 'Row 5 is focused');
- assert.equal(counter, 2, 'scrollToElementVertically called twice');
});
QUnit.test('Popup should apply data changes after editorOptions changing (T817880)', function(assert) {
@@ -19081,8 +19265,7 @@ QUnit.test('The draggable row should have correct markup when defaultOptions is
}
});
-// T827960
-QUnit.test('The onFocusedRowChanged should be fired if change focusedRowKey to same page and loadPanel in onContentReady', function(assert) {
+QUnit.test('The onFocusedRowChanged should be fired if change focusedRowKey to same page and loadPanel in onContentReady (T827960)', function(assert) {
// arrange
const onFocusedRowChangedSpy = sinon.spy();
const dataGrid = createDataGrid({
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/dataSource.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/dataSource.tests.js
index 39d6e569d81c..8134cb44783c 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/dataSource.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/dataSource.tests.js
@@ -2561,7 +2561,7 @@ QUnit.test('Update group offset for expanded grouped row of the first level when
// act
source.group([{ selector: 'field1', desc: true, isExpanded: true }, { selector: 'field2', isExpanded: true }]);
source.reload();
- window.test = source;
+
// assert
assert.equal(source.totalItemsCount(), 5);
assert.deepEqual(source.items(), [{
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/editing.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/editing.tests.js
index fd85d4a992bd..2590e89d523e 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/editing.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/editing.tests.js
@@ -14930,6 +14930,48 @@ QUnit.test('The edit form should not be rerendered when setCellValue is set for
assert.strictEqual($editForm.find('.dx-datagrid-edit-form-item').first().find('.dx-texteditor-input').val(), 'Test', 'first cell value is changed');
});
+// T848729
+QUnit.test('The onRowClick event should not be fired when clicking on a save button in the edit form', function(assert) {
+ // arrange
+ this.options.loadingTimeout = 30;
+ this.options.repaintChangesOnly = true;
+ this.options.editing.texts = {
+ saveRowChanges: 'Save'
+ };
+ const onRowClick = this.options.onRowClick = sinon.spy((e) => {
+ this.editRow(e.rowIndex);
+ });
+ this.options.rowTemplate = function(container) {
+ $('
|
').appendTo(container);
+ };
+ this.setupModules(this);
+ this.clock.tick(30);
+
+ const rowsView = this.rowsView;
+ const $testElement = $('#container');
+
+ rowsView.render($testElement);
+
+ this.editRow(0);
+ this.cellValue(0, 'name', 'Test');
+
+ let $rowElement = $(this.getRowElement(0));
+ const $saveButton = $rowElement.find('.dx-button').first();
+
+ // assert
+ assert.ok($rowElement.hasClass('dx-datagrid-edit-form'), 'has edit form');
+ assert.strictEqual($saveButton.text(), 'Save', 'has save button');
+
+ // act
+ $saveButton.trigger('dxclick');
+ this.clock.tick(30);
+
+ // assert
+ $rowElement = $(this.getRowElement(0));
+ assert.notOk($rowElement.hasClass('dx-datagrid-edit-form'), 'has not edit form');
+ assert.strictEqual(onRowClick.callCount, 0, 'onRowClick event is not fired');
+});
+
QUnit.module('Editing - "popup" mode', {
beforeEach: function() {
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/exportController.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/exportController.tests.js
index 03d6560adfeb..087e366f39b3 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/exportController.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/exportController.tests.js
@@ -2535,7 +2535,7 @@ QUnit.test('Context menu is removed when the allowExportSelectedData option is c
$exportMenu = $('.dx-context-menu.dx-datagrid-export-menu').first();
- assert.ok($exportMenu.length === 0);
+ assert.strictEqual($exportMenu.length, 0);
});
QUnit.test('Hide export button via option', function(assert) {
@@ -2607,7 +2607,7 @@ QUnit.test('Show export button via option when the enabled option is disabled',
assert.ok(this.headerPanel.isVisible(), 'is visible');
$exportButton = $container.find('.dx-datagrid-export-button');
assert.equal($exportButton.length, 1, 'export button is contained in a DOM');
- assert.ok($exportButton.css('display') !== 'none', 'export button is shown');
+ assert.notStrictEqual($exportButton.css('display'), 'none', 'export button is shown');
});
QUnit.test('The export context menu is shown', function(assert) {
@@ -2905,7 +2905,7 @@ QUnit.test('Customize a data and a columns before exporting', function(assert) {
assert.equal(exportedItems[3].values[1], 'TEST 30', '4 exported item of data');
assert.equal(exportedItems[4].values[1], 'TEST 30', '5 exported item of data');
- assert.ok(columns[2].width !== 333, 'third column\'s width');
+ assert.notStrictEqual(columns[2].width, 333, 'third column\'s width');
assert.equal(items[1].values[2], '3', '2 item of data');
assert.equal(items[2].values[2], '3', '3 item of data');
assert.equal(items[3].values[2], '3', '4 item of data');
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/fixedColumns.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/fixedColumns.tests.js
index 1b73817af853..e27d812c463f 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/fixedColumns.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/fixedColumns.tests.js
@@ -1144,8 +1144,8 @@ QUnit.test('Synchronize rows for main table', function(assert) {
that.rowsView.resize();
// assert
- assert.ok($table[0].offsetHeight === $fixTable[0].offsetHeight, 'height table and fixed table');
- assert.ok($table.find('tbody > tr')[0].offsetHeight === $fixTable.find('tbody > tr')[0].offsetHeight, 'height row and fixed row');
+ assert.strictEqual($table[0].offsetHeight, $fixTable[0].offsetHeight, 'height table and fixed table');
+ assert.strictEqual($table.find('tbody > tr')[0].offsetHeight, $fixTable.find('tbody > tr')[0].offsetHeight, 'height row and fixed row');
});
QUnit.test('Synchronize rows for fixed table', function(assert) {
@@ -1173,8 +1173,8 @@ QUnit.test('Synchronize rows for fixed table', function(assert) {
that.rowsView.resize();
// assert
- assert.ok($table[0].offsetHeight === $fixTable[0].offsetHeight, 'height table and fixed table');
- assert.ok($table.find('tbody > tr')[0].offsetHeight === $fixTable.find('tbody > tr')[0].offsetHeight, 'height row and fixed row');
+ assert.strictEqual($table[0].offsetHeight, $fixTable[0].offsetHeight, 'height table and fixed table');
+ assert.strictEqual($table.find('tbody > tr')[0].offsetHeight, $fixTable.find('tbody > tr')[0].offsetHeight, 'height row and fixed row');
});
// T234513
@@ -1210,8 +1210,8 @@ QUnit.test('Synchronize rows for fixed table with master detail', function(asser
assert.equal($table.find('tbody > tr').length, 4, 'count rows');
assert.equal($fixTable.find('tbody > tr').length, 4, 'count fixed rows');
- assert.ok($table.find('tbody > tr')[0].getBoundingClientRect().height === $fixTable.find('tbody > tr')[0].getBoundingClientRect().height, 'height first row');
- assert.ok($table.find('tbody > tr')[1].getBoundingClientRect().height === $fixTable.find('tbody > tr')[1].getBoundingClientRect().height, 'height second row');
+ assert.strictEqual($table.find('tbody > tr')[0].getBoundingClientRect().height, $fixTable.find('tbody > tr')[0].getBoundingClientRect().height, 'height first row');
+ assert.strictEqual($table.find('tbody > tr')[1].getBoundingClientRect().height, $fixTable.find('tbody > tr')[1].getBoundingClientRect().height, 'height second row');
assert.roughEqual($table.find('tbody > tr')[2].getBoundingClientRect().height, $fixTable.find('tbody > tr')[2].getBoundingClientRect().height, 0.1, 'height third row');
});
@@ -1240,7 +1240,7 @@ QUnit.test('Synchronize rows with floating-point height', function(assert) {
that.columnHeadersView.resize();
// assert
- assert.ok(that.columnHeadersView._getClientHeight($table.find('tbody > tr').get(0)) === that.columnHeadersView._getClientHeight($fixTable.find('tbody > tr').get(0)), 'height row and fixed row');
+ assert.strictEqual(that.columnHeadersView._getClientHeight($table.find('tbody > tr').get(0)), that.columnHeadersView._getClientHeight($fixTable.find('tbody > tr').get(0)), 'height row and fixed row');
});
// T246724
@@ -2062,7 +2062,7 @@ QUnit.test('Updating position of the fixed table (when scrollbar at the bottom)
that.rowsView.resize();
// assert
- assert.ok($fixedTable.position().top !== positionTop, 'scroll top of the fixed table is changed');
+ assert.notStrictEqual($fixedTable.position().top, positionTop, 'scroll top of the fixed table is changed');
done();
});
});
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js
index 327afea63e17..4346c8b5682e 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/focus.tests.js
@@ -75,10 +75,8 @@ const getModuleConfig = function(keyboardNavigationEnabled) {
};
};
-QUnit.module('FocusedRow with real dataController, keyboard and columnsController', getModuleConfig(true), () => {
+QUnit.module('Focused row', getModuleConfig(true), () => {
QUnit.testInActiveWindow('TabIndex should set for the [focusedRowIndex; focusedColumnIndex] cell', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowIndex: 1,
@@ -91,7 +89,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// act
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(rowsView.getRow(0).attr('tabindex'), undefined, 'Row 0 tabIndex');
@@ -212,9 +210,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Arrow Up key should decrease focusedRowIndex', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.$element = function() {
return $('#container');
@@ -229,8 +224,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -242,9 +237,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Arrow keys should move focused row if columnHidingEnabled is true', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.$element = function() {
return $('#container');
@@ -262,15 +254,15 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'FocusedRowIndex is 1');
assert.ok(rowsView.getRow(1).hasClass('dx-row-focused'), 'FocusedRow');
// act
- $(this.getCellElement(1, 0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
keyboardController._upDownKeysHandler({ key: 'ArrowUp', keyName: 'upArrow' });
this.clock.tick();
// assert
@@ -279,9 +271,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Handle arrow keys without focused cell if focusedRowIndex and columnHidingEnabled is true', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.$element = function() {
return $('#container');
@@ -299,8 +288,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
try {
@@ -316,9 +305,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Arrow Down key should increase focusedRowIndex', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.$element = function() {
return $('#container');
@@ -332,8 +318,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
assert.equal(this.option('focusedRowIndex'), 0, 'FocusedRowIndex is 0');
@@ -344,9 +330,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Click by cell should focus the row', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.$element = function() {
return $('#container');
@@ -363,8 +346,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
+ let rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
@@ -397,8 +380,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Tab key should focus the cell', function(assert) {
- let rowsView;
-
// arrange
this.$element = function() {
return $('#container');
@@ -418,13 +399,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
this.clock.tick();
// act
- $(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(1).find('td').eq(0)).trigger(CLICK_EVENT).click();
this.triggerKeyDown('tab', false, false, rowsView.element().find(':focus').get(0));
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'focusedRowIndex');
@@ -437,7 +418,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Tab key before grid should focus the first row (legacyKbn)', function(assert) {
const that = this;
- let rowsView;
// arrange
this.$element = function() {
@@ -459,7 +439,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
@@ -504,7 +484,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Tab key before rows view should focus the first row', function(assert) {
const that = this;
- let rowsView;
// arrange
this.$element = function() {
@@ -525,7 +504,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
@@ -539,8 +518,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('LeftArrow key should focus the cell', function(assert) {
- let rowsView;
-
// arrange
this.$element = function() {
return $('#container');
@@ -560,13 +537,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
this.clock.tick();
// act
- $(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(1).find('td').eq(0)).trigger(CLICK_EVENT).click();
this.triggerKeyDown('leftArrow', false, false, rowsView.element().find(':focus').get(0));
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'FocusedRowIndex = 1');
@@ -578,8 +555,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('RightArrow key should focus the cell', function(assert) {
- let rowsView;
-
// arrange
this.$element = function() {
return $('#container');
@@ -599,13 +574,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
this.clock.tick();
// act
- $(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(1).find('td').eq(0)).trigger(CLICK_EVENT).click();
this.triggerKeyDown('rightArrow', false, false, rowsView.element().find(':focus').get(0));
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'FocusedRowIndex = 1');
@@ -617,8 +592,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('ArrowUp / ArrowDown should not change focus type', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowEnabled: true
@@ -634,7 +607,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
addOptionChangedHandlers(this);
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex');
@@ -660,8 +634,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Focus row by click if virtual scrolling mode', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowEnabled: true,
@@ -692,7 +664,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
@@ -704,9 +676,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should restore focused row when data without focused row was filtered', function(assert) {
- let rowsView;
- let visibleRows;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -729,15 +698,15 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- $(this.getCellElement(5, 0)).trigger(pointerEvents.up).focus();
+ $(this.getCellElement(5, 0)).trigger(CLICK_EVENT).focus();
// act
this.dataController.filter('team', '=', 'public');
this.dataController.load();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- visibleRows = this.dataController.getVisibleRows();
+ const rowsView = this.gridView.getView('rowsView');
+ const visibleRows = this.dataController.getVisibleRows();
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'focusedRowIndex');
@@ -747,9 +716,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should restore focused row when focused row data was filtered', function(assert) {
- let rowsView;
- let visibleRows;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -772,15 +738,15 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- $(this.getCellElement(5, 0)).trigger(pointerEvents.up).focus();
+ $(this.getCellElement(5, 0)).trigger(CLICK_EVENT).focus();
// act
this.dataController.filter('team', '=', 'internal');
this.dataController.load();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- visibleRows = this.dataController.getVisibleRows();
+ const rowsView = this.gridView.getView('rowsView');
+ const visibleRows = this.dataController.getVisibleRows();
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'focusedRowIndex');
@@ -791,9 +757,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// T848606
QUnit.testInActiveWindow('DataGrid should not infinitly load data when filter with no suitable rows was applied', function(assert) {
// arrange
- let visibleRows;
let loadCallCount = 0;
- let items = [];
+ const items = [];
for(let i = 0; i < 60; i++) {
items.push({
@@ -849,7 +814,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.dataController.load();
this.clock.tick(100);
- visibleRows = this.dataController.getVisibleRows();
+ const visibleRows = this.dataController.getVisibleRows();
// assert
assert.equal(this.option('focusedRowKey'), 40, 'focusedRowKey');
@@ -859,8 +824,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Tab index should not exist for the previous focused row', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowEnabled: true,
@@ -876,13 +839,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// act
- $(rowsView.getRow(0).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(0).find('td').eq(0)).trigger(CLICK_EVENT).click();
this.clock.tick();
this.triggerKeyDown('rightArrow', false, false, rowsView.element().find(':focus').get(0));
- $(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(1).find('td').eq(0)).trigger(CLICK_EVENT).click();
// assert
assert.equal($(rowsView.getRow(0)).find('[tabindex="0"]').length, 1, 'Row 0 has tabindex');
// act
@@ -894,8 +857,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Set focusedRowIndex, focusedColumnIndex should focus the cell', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowIndex: 1,
@@ -911,7 +872,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'FocusedRowIndex = 1');
@@ -948,8 +909,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Escape should change focus type from cell to row if focusedRowEnabled', function(assert) {
- let rowsView;
-
// arrange
this.$element = function() {
return $('#container');
@@ -965,13 +924,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
this.clock.tick();
// act
- $(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(rowsView.getRow(1).find('td').eq(0)).trigger(CLICK_EVENT).click();
this.triggerKeyDown('rightArrow', false, false, rowsView.element().find(':focus').get(0));
// assert
assert.ok(this.getController('keyboardNavigation').isCellFocusType(), 'Cell focus type');
@@ -982,8 +941,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Escape should not change focus type from cell to row if not focusedRowEnabled', function(assert) {
- let rowsView;
-
// arrange
this.$element = function() {
return $('#container');
@@ -998,7 +955,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), undefined, 'FocusedRowIndex is undefined');
@@ -1015,8 +972,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Not highlight cell by isHighlighted arg in the onFocusedCellChanging event by LeftArrow key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1045,8 +1000,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1062,8 +1017,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by LeftArrow key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1101,8 +1054,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1116,8 +1069,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by RightArrow key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1154,8 +1105,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1169,8 +1120,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by RightArrow key and change newRowIndex, newColumnIndex', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1204,8 +1153,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1222,8 +1171,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging, onFocusedRowChanging by DownArrow key and change newRowIndex, newColumnIndex', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
let focusedRowChangingCount = 0;
@@ -1260,8 +1207,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1280,8 +1227,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by UpArrow key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1322,8 +1267,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1339,8 +1284,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by DownArrow key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -1381,8 +1324,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1398,7 +1341,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by UpDownArrow keys may prevent change focused row', function(assert) {
- let keyboardController;
let focusedColumnChangingCount = 0;
let focusedRowChangingCount = 0;
@@ -1438,7 +1380,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.gridView.getView('rowsView');
// act
@@ -1451,8 +1393,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Tab key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1489,11 +1429,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1514,8 +1454,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Tab key in back order (shift presset)', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
// arrange
@@ -1551,11 +1489,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(2)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 2)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1576,8 +1514,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Tab key if cell is being edited', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
// arrange
@@ -1602,11 +1538,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1634,8 +1570,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'moveFocus\'', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1676,11 +1610,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1701,8 +1635,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'startEdit\'', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1744,11 +1676,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1773,8 +1705,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'moveFocus\'', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1816,11 +1746,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1836,9 +1766,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if \'enterKeyDirection\' is \'column\', \'enterKeyAction\' is \'startEdit\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if enterKeyDirection: column, enterKeyAction: startEdit', function(assert) {
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1880,11 +1808,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1908,9 +1836,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if \'enterKeyDirection\' is \'column\', \'enterKeyAction\' is \'moveFocus\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Fire onFocusedCellChanging by Enter key if enterKeyDirection: column, enterKeyAction: moveFocus', function(assert) {
let focusedCellChangingCounter = 0;
let columnIndex;
@@ -1952,11 +1878,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -1972,9 +1898,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Changing row index by Enter key navigation if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'moveFocus\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Changing row index by Enter key navigation if enterKeyDirection: row, enterKeyAction: moveFocus', function(assert) {
let focusedCellChangingCounter = 0;
// arrange
@@ -2010,11 +1934,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2030,9 +1954,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Changing row index by Enter key navigation if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'startEdit\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Changing row index by Enter key navigation if enterKeyDirection: row, enterKeyAction: startEdit', function(assert) {
let focusedCellChangingCounter = 0;
// arrange
@@ -2068,11 +1990,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2096,9 +2018,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Enter key navigation from the last cell should navigate to the new row and first column if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'startEdit\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Enter key navigation from the last cell should navigate to the new row and first column if enterKeyDirection: row, enterKeyAction: startEdit', function(assert) {
let focusedCellChangingCounter = 0;
// arrange
@@ -2131,11 +2051,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.getCellElement(1, 2)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 2)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2159,9 +2079,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.notOk(this.editingController.isEditing(), 'Is editing');
});
- QUnit.testInActiveWindow('Enter key navigation from the last cell should navigate to the new row and first column if \'enterKeyDirection\' is \'row\', \'enterKeyAction\' is \'moveFocus\'', function(assert) {
- let rowsView;
- let keyboardController;
+ QUnit.testInActiveWindow('Enter key navigation from the last cell should navigate to the new row and first column if enterKeyDirection: row, enterKeyAction: moveFocus', function(assert) {
let focusedCellChangingCounter = 0;
// arrange
@@ -2194,11 +2112,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.getCellElement(1, 2)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 2)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2215,7 +2133,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Group row should focused on focus()', function(assert) {
- let keyboardController;
let focusedCellChangingCount = 0;
// arrange
@@ -2243,7 +2160,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus(null);
this.clock.tick(500);
@@ -2255,7 +2172,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Highlight group row on focus()', function(assert) {
- let keyboardController;
let focusedCellChangingCount = 0;
// arrange
@@ -2284,7 +2200,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus(null);
this.clock.tick(500);
@@ -2297,7 +2213,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Highlight cell on focus()', function(assert) {
let focusedCellChangingCount = 0;
- let keyboardController;
// arrange
this.options = {
focusedRowIndex: 1,
@@ -2313,7 +2228,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus(null);
this.clock.tick();
@@ -2325,7 +2240,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Highlight cell on focus() if focusedRowIndex, focusedColumnIndex are not set', function(assert) {
let focusedCellChangingCount = 0;
- let keyboardController;
// arrange
this.options = {
onFocusedCellChanging: function(e) {
@@ -2337,7 +2251,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus();
this.clock.tick();
@@ -2370,7 +2284,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
onFocusedRowChanging: function(e) {
++focusedRowChangingCount;
assert.equal(e.cancel, false);
- assert.equal(e.event.type, pointerEvents.up);
+ assert.ok(CLICK_EVENT.indexOf(e.event.type) === 0);
assert.equal(e.newRowIndex, 1);
assert.equal(e.prevRowIndex, 4);
assert.equal(e.rows.length, 6);
@@ -2383,7 +2297,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
assert.equal(this.getController('keyboardNavigation').getVisibleRowIndex(), 1, 'Focused row index is 1');
@@ -2391,9 +2305,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedRowChanging by UpArrow key', function(assert) {
- let rowsView;
let focusedRowChangingCount = 0;
- let keyboardController;
// arrange
this.data = [
@@ -2426,8 +2338,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2440,9 +2352,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid - should restore previos row index after the focus losing (T804103)', function(assert) {
- let rowsView;
let focusedRowChangingCount = 0;
- let keyboardController;
// arrange
this.data = [{ name: 'Alex' }, { name: 'Dan' }];
@@ -2472,8 +2382,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
// act
$(rowsView.getCellElement(0, 0)).trigger(CLICK_EVENT);
@@ -2486,10 +2396,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Fire onFocusedRowChanging by UpArrow key when virtual scrolling is enabled', function(assert) {
// arrange
- let rowsView;
- let scrollable;
- let $scrollContainer; let focusedRowChangingCount = 0;
- let keyboardController;
+ let focusedRowChangingCount = 0;
this.data = generateItems(100);
@@ -2519,12 +2426,12 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.setupModule();
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
rowsView.height(400);
rowsView.resize();
- scrollable = rowsView.getScrollable();
- $scrollContainer = $(scrollable._container());
- keyboardController = this.getController('keyboardNavigation');
+ const scrollable = rowsView.getScrollable();
+ const $scrollContainer = $(scrollable._container());
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2541,9 +2448,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedRowChanging by DownArrow key', function(assert) {
- let rowsView;
let focusedRowChangingCount = 0;
- let keyboardController;
// arrange
this.data = [
@@ -2576,8 +2481,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2590,8 +2495,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedRowChanging by Tab key', function(assert) {
- let rowsView;
- let keyboardController;
let focusedRowChangingCounter = 0;
// arrange
@@ -2625,11 +2528,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2656,8 +2559,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedRowChanging by Tab key in back order (shift presset)', function(assert) {
- let rowsView;
- let keyboardController;
let focusedRowChangingCounter = 0;
// arrange
@@ -2691,11 +2592,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(2)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 2)).trigger(CLICK_EVENT).click();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -2756,7 +2657,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
assert.equal(focusedRowChangingCount, 1, 'focusedRowChanging count');
@@ -2767,9 +2668,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('Focused row events should not fire if dataGrid is in loading phase', function(assert) {
let focusedRowChangingCount = 0;
let focusedRowChangedCount = 0;
- let dataController;
- let keyboardController;
-
const items = [
{ name: 'Alex', phone: '111111', room: 6 },
{ name: 'Dan', phone: '2222222', room: 5 },
@@ -2817,15 +2715,15 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
- dataController = this.getController('data');
+ const dataController = this.getController('data');
this.clock.tick(10);
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.gridView.getView('rowsView');
// act
- $(this.gridView.getView('rowsView').getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 0)).trigger(CLICK_EVENT).click();
keyboardController._upDownKeysHandler({ key: 'ArrowDown', keyName: 'downArrow' });
keyboardController._upDownKeysHandler({ key: 'ArrowDown', keyName: 'downArrow' });
keyboardController._upDownKeysHandler({ key: 'ArrowDown', keyName: 'downArrow' });
@@ -2839,7 +2737,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// T850527
QUnit.testInActiveWindow('onFocusedChanged args should be correct after data change', function(assert) {
// arrange
- let onFocusedRowChangedSpy = sinon.spy();
+ const onFocusedRowChangedSpy = sinon.spy();
this.data = [
{ id: 1 },
@@ -2861,7 +2759,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- $(this.gridView.getView('rowsView').getRow(0).find('td').eq(0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(0, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
assert.equal(onFocusedRowChangedSpy.callCount, 1, 'focusedRowChanged count');
@@ -2925,9 +2823,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.test('onFocusedCellChanged event should contains correct row object if scrolling mode is virtual', function(assert) {
const that = this;
let focusedCellChangedCount = 0;
- let rowsView;
- let scrollable;
- let visibleRow;
// arrange
that.data = generateItems(50);
@@ -2961,17 +2856,17 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
that.setupModule();
that.gridView.render($('#container'));
- rowsView = that.gridView.getView('rowsView');
+ const rowsView = that.gridView.getView('rowsView');
rowsView.height(100);
rowsView.resize();
- scrollable = rowsView.getScrollable();
+ const scrollable = rowsView.getScrollable();
that.clock.tick();
// act
scrollable.scrollBy({ y: 400 });
that.clock.tick();
- visibleRow = that.getVisibleRows()[0];
+ const visibleRow = that.getVisibleRows()[0];
$(that.getCellElement(0, 1)).trigger(CLICK_EVENT);
// assert
assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count');
@@ -2980,9 +2875,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.test('onFocusedCellChanged event should contains correct row object if scrolling, rowRenderingMode are virtual', function(assert) {
const that = this;
let focusedCellChangedCount = 0;
- let rowsView;
- let scrollable;
- let visibleRow;
// arrange
that.data = generateItems(50);
@@ -3016,25 +2908,23 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
that.setupModule();
that.gridView.render($('#container'));
- rowsView = that.gridView.getView('rowsView');
+
+ const rowsView = that.gridView.getView('rowsView');
rowsView.height(100);
rowsView.resize();
- scrollable = rowsView.getScrollable();
-
+ const scrollable = rowsView.getScrollable();
that.clock.tick();
// act
scrollable.scrollBy({ y: 400 });
that.clock.tick();
- visibleRow = that.getVisibleRows()[0];
+ const visibleRow = that.getVisibleRows()[0];
$(that.getCellElement(0, 1)).trigger(CLICK_EVENT);
// assert
assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count');
});
QUnit.testInActiveWindow('Setting cancel in onFocusedCellChanging event should prevent focusing next cell', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -3076,8 +2966,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -3091,8 +2981,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should fire onFocusedCellChanging event if next focused cell is not valid', function(assert) {
- let rowsView;
- let keyboardController;
let onFocusedCellCount = 0;
// arrange
@@ -3127,9 +3015,9 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -3144,8 +3032,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Fire onFocusedCellChanging by click', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -3176,12 +3062,12 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
- $(this.gridView.getView('rowsView').getRow(4).find('td').eq(1)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(4, 1)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
assert.equal(this.getController('keyboardNavigation').getVisibleColumnIndex(), 1, 'Focused column index');
@@ -3189,8 +3075,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Highlight cell by isHighlighted arg in the onFocusedCellChanging event by click event', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
// arrange
@@ -3216,12 +3100,12 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
- $(rowsView.getRow(4).find('td').eq(1)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(4, 1)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
assert.equal(this.getController('keyboardNavigation').getVisibleColumnIndex(), 1, 'Focused column index');
@@ -3230,8 +3114,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('isHighlighted in the onFocusedCellChanged event', function(assert) {
- let rowsView;
- let keyboardController;
let focusedColumnChangingCount = 0;
let focusedColumnChangedCount = 0;
@@ -3252,12 +3134,12 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
- $(rowsView.getRow(1).find('td').eq(1)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 1)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
assert.equal(focusedColumnChangingCount, 1, 'onFocusedCellChanging fires count');
@@ -3269,8 +3151,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// arrange
let focusedRowChangedCount = 0;
let focusedRowChangingCount = 0;
- let rowsView;
-
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
{ name: 'Dan', phone: '2222222', room: 5 }
@@ -3296,12 +3176,10 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
-
// act
this.option('focusedRowEnabled', true);
- $(rowsView.getRow(1).find('td').eq(1)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(1, 1)).trigger(CLICK_EVENT).click();
// assert
assert.equal(focusedRowChangedCount, 1, 'onFocusedRowChanged fires count');
@@ -3309,7 +3187,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('onFocusedCellChanged event', function(assert) {
- let rowsView;
let focusedCellChangedCount = 0;
// arrange
@@ -3345,16 +3222,13 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- rowsView = this.gridView.getView('rowsView');
- $(rowsView.getRow(1).find('td').eq(1)).trigger(pointerEvents.up).click();
+ const rowsView = this.gridView.getView('rowsView');
+ $(this.getCellElement(1, 1)).trigger(CLICK_EVENT).click();
assert.equal(focusedCellChangedCount, 1, 'onFocusedCellChanged fires count');
});
QUnit.testInActiveWindow('onFocusedCellChanged event should fire if row index changed', function(assert) {
- let rowsView;
let focusedCellChangedCount = 0;
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -3387,8 +3261,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -3401,10 +3275,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('onFocusedCellChanged event should not fire if cell position not changed', function(assert) {
- let rowsView;
let focusedCellChangedCount = 0;
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -3434,8 +3305,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -3452,8 +3323,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// T755462
QUnit.testInActiveWindow('The page with focused row should load without errors after sorting the boolean column', function(assert) {
// arrange
- let focusedRowIndex;
-
this.data = [
{ name: 'Alex', phone: '111111', isRoom: true },
{ name: 'Dan', phone: '2222222', isRoom: true },
@@ -3502,7 +3371,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// assert
- focusedRowIndex = this.option('focusedRowIndex');
+ const focusedRowIndex = this.option('focusedRowIndex');
assert.strictEqual(this.pageIndex(), 1, 'pageIndex');
assert.strictEqual(this.dataController.getVisibleRows()[focusedRowIndex].data, this.data[0], 'Focused row data is on the page');
@@ -3522,7 +3391,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.test('Focused row should be visible if set focusedRowKey', function(assert) {
// arrange
- let rowsView;
let counter = 0;
this.data = [
@@ -3544,7 +3412,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.setupModule();
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
rowsView.scrollToElementVertically = $row => {
++counter;
assert.equal($row.find('td').eq(0).text(), 'Smith', 'Row');
@@ -3559,10 +3427,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Keyboard navigation controller should find next cell if column index is wrong when jump from the group row', function(assert) {
- let rowsView;
- let keyboardController;
- let $cell;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -3598,21 +3462,18 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
assert.equal(this.option('focusedRowIndex'), 0, 'FocusedRowIndex is 0');
// act
- $cell = keyboardController._getNextCell('downArrow');
+ const $cell = keyboardController._getNextCell('downArrow');
// assert
assert.ok(keyboardController._isCellValid($cell), 'Found valid cell');
});
QUnit.testInActiveWindow('DataGrid should focus the row bellow by arrowDown key if grid focused and if selection multiple', function(assert) {
- let rowsView;
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -3643,8 +3504,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
assert.equal(this.option('focusedRowIndex'), 0, 'FocusedRowIndex is 0');
@@ -3656,9 +3517,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should not focus inserted but not saved rows (T727182)', function(assert) {
- let rowsView;
- let keyboardController;
-
this.options = {
keyExpr: 'name',
focusedRowEnabled: true,
@@ -3673,8 +3531,9 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
addOptionChangedHandlers(this);
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// assert
@@ -3696,8 +3555,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('DataGrid should reset focused row if \'e.newRowIndex\' is set to < 0 value in the onFocusedRowChanging event (T745451)', function(assert) {
// arrange
let focusedRowChangingCount = 0;
- let rowsView;
-
this.$element = function() {
return $('#container');
};
@@ -3715,7 +3572,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.setupModule();
addOptionChangedHandlers(this);
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
this.clock.tick();
try {
@@ -3761,7 +3618,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.equal($(this.getCellElement(0, 0)).attr('tabindex'), 0, 'tabindex');
});
- QUnit.testInActiveWindow('Highlight cell on click when startEditAction is \'dblClick\'', function(assert) {
+ QUnit.testInActiveWindow('Highlight cell on click when startEditAction: dblClick', function(assert) {
// arrange
let focusedCellChangingCount = 0;
@@ -3782,7 +3639,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- $(this.getCellElement(0, 0)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(0, 0)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
@@ -3791,8 +3648,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid - onFocusedCellChanging event should execute on cell click in batch edit mode (T743530)', function(assert) {
- let rowsView;
- let keyboardController;
let focusedCellChangingCount = 0;
// arrange
@@ -3813,12 +3668,12 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
- $(rowsView.getRow(0).find('td').eq(1)).trigger(pointerEvents.up).click();
+ $(this.getCellElement(0, 1)).trigger(CLICK_EVENT).click();
this.clock.tick();
// assert
assert.equal(focusedCellChangingCount, 1, 'onFocusedCellChanging fires count');
@@ -3880,6 +3735,66 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
assert.equal(this.option('focusedRowKey'), 'Mark2', 'FocusedRowkey');
});
+ QUnit.test('autoNavigateToFocusedRow == false and paging if scrolling mode is virtual', function(assert) {
+ this.options = {
+ focusedRowEnabled: true,
+ autoNavigateToFocusedRow: false,
+ onFocusedRowChanged: sinon.spy(),
+ keyExpr: 'id',
+ scrolling: {
+ mode: 'virtual'
+ },
+ pager: {
+ visible: true
+ },
+ paging: {
+ pageSize: 2
+ }
+ };
+
+ this.data = [
+ { id: 1 },
+ { id: 2 },
+ { id: 3 },
+ { id: 4 },
+ { id: 5 },
+ { id: 6 },
+ { id: 7 },
+ { id: 8 }
+ ];
+
+ this.setupModule();
+ addOptionChangedHandlers(this);
+
+ this.gridView.render($('#container'));
+ this.clock.tick();
+
+ this.option('focusedRowIndex', 0);
+
+ // assert
+ assert.equal(this.option('focusedRowIndex'), 0, 'focusedRowIndex');
+ assert.equal(this.option('focusedRowKey'), 1, 'focusedRowkey');
+ assert.equal(this.options.onFocusedRowChanged.callCount, 1, 'onFocusedRowChanged called once');
+
+ // act
+ this.pageIndex(3);
+ this.clock.tick();
+
+ // assert
+ assert.equal(this.option('focusedRowIndex'), 0, 'focusedRowIndex');
+ assert.equal(this.option('focusedRowKey'), 1, 'focusedRowkey');
+ assert.equal(this.options.onFocusedRowChanged.callCount, 1, 'onFocusedRowChanged called once');
+
+ // act
+ this.pageIndex(0);
+ this.clock.tick();
+
+ // assert
+ assert.equal(this.option('focusedRowIndex'), 0, 'focusedRowIndex');
+ assert.equal(this.option('focusedRowKey'), 1, 'focusedRowkey');
+ assert.equal(this.options.onFocusedRowChanged.callCount, 1, 'onFocusedRowChanged called once');
+ });
+
QUnit.test('Change \'pageIndex\' by API without focused row should focus it by \'focusedRowIndex\' if autoNavigateToFocusedRow == false and row or cell was focused', function(assert) {
// arrange
this.options = {
@@ -4121,8 +4036,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('FocusedRow should present if set focusedRowIndex', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowEnabled: true,
@@ -4136,7 +4049,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.notOk($(rowsView.getRow(0)).hasClass('dx-row-focused'), 'Row 0 has no focus');
@@ -4173,8 +4086,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Focus row if virtual scrolling mode', function(assert) {
- let rowsView;
-
// arrange
this.options = {
focusedRowIndex: 4,
@@ -4205,7 +4116,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), 4, 'FocusedRowIndex = 4');
@@ -4213,8 +4124,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Focus row if virtual scrolling and index is on the not loaded page', function(assert) {
- let rowsView;
-
// arrange
this.options = {
height: 40,
@@ -4247,7 +4156,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), 3, 'focusedRowIndex');
@@ -4399,8 +4308,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Focus row if grouping and virtual scrolling mode', function(assert) {
- let rowsView;
-
// arrange
this.options = {
keyExpr: 'name',
@@ -4440,7 +4347,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.option('focusedRowIndex'), 9, 'FocusedRowIndex');
@@ -4449,8 +4356,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.test('Focus next row if grouping and virtual scrolling mode', function(assert) {
- let rowsView;
-
// arrange
this.options = {
keyExpr: 'name',
@@ -4486,7 +4391,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
addOptionChangedHandlers(this);
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
this.gridView.render($('#container'));
rowsView.height(140);
@@ -4508,10 +4413,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should focus row by focusedRowIndex if data was filtered', function(assert) {
- let rowsView;
- let visibleRows;
- let keyboardController;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -4540,9 +4441,9 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.dataController.load();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- visibleRows = this.dataController.getVisibleRows();
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const visibleRows = this.dataController.getVisibleRows();
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
keyboardController.focus(rowsView.getRow(0).children('td').eq(0));
@@ -4554,9 +4455,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should focus the row by focusedRowKey if row key present in data after filter', function(assert) {
- let rowsView;
- let visibleRows;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -4589,8 +4487,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.dataController.load();
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- visibleRows = this.dataController.getVisibleRows();
+ const rowsView = this.gridView.getView('rowsView');
+ const visibleRows = this.dataController.getVisibleRows();
// assert
assert.equal(this.option('focusedRowIndex'), 1, 'focusedRowIndex');
@@ -4600,10 +4498,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should focus the row below by arrowDown key if grid focused and grouping enabled', function(assert) {
- let rowsView;
- let keyboardController;
- let $cell;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -4632,22 +4526,20 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
keyboardController.setFocusedColumnIndex(0);
keyboardController.focus(rowsView.getRow(1).find('td').eq(0));
- $cell = keyboardController._getNextCell('downArrow');
+ const $cell = keyboardController._getNextCell('downArrow');
// assert
assert.equal($cell, undefined, 'Cell is undefined');
});
QUnit.testInActiveWindow('DataGrid should focus the corresponding group row if group collapsed and inner data row was focused', function(assert) {
- let rowsView;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -4675,7 +4567,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.getVisibleRows()[3].rowType, 'group', 'group row');
@@ -4694,8 +4586,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('DataGrid should focus the corresponding group row if group collapsed and inner data row was focused if calculateGroupValue is used', function(assert) {
- let rowsView;
-
// arrange
this.data = [
{ team: 'internal', name: 'Alex', age: 30 },
@@ -4723,7 +4613,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// assert
assert.equal(this.getVisibleRows()[3].rowType, 'group', 'group row');
@@ -4893,9 +4783,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Highlight cell on focus() if focusedRowEnabled is true and focusedColumnIndex, focusedRowIndex are set', function(assert) {
- let focusedCellChangingCount = 0;
- let keyboardController;
// arrange
+ let focusedCellChangingCount = 0;
this.options = {
focusedRowIndex: 1,
focusedColumnIndex: 1,
@@ -4911,7 +4800,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus(null);
this.clock.tick();
@@ -4922,9 +4811,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('Not highlight cell on focus() if focusedRowEnabled is true and focusedColumnIndex is not set', function(assert) {
- let focusedCellChangingCount = 0;
- let keyboardController;
// arrange
+ let focusedCellChangingCount = 0;
this.options = {
focusedRowEnabled: true,
onFocusedCellChanging: function(e) {
@@ -4936,7 +4824,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = this.getView('rowsView');
keyboardController.focus(null);
this.clock.tick();
@@ -5117,10 +5005,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('onFocusedCellChanged event should not fire if cell position updates for not cell element', function(assert) {
- let rowsView;
let focusedCellChangedCount = 0;
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -5140,8 +5025,8 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// act
- rowsView = this.gridView.getView('rowsView');
- keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._updateFocusedCellPosition(rowsView.getRow(1));
// assert
@@ -5180,8 +5065,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.test('Test navigateToRow method if paging', function(assert) {
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -5207,7 +5090,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
assert.equal(this.pageIndex(), 0, 'Page index');
assert.equal(keyboardController.getVisibleRowIndex(), undefined, 'Focused row index');
@@ -5220,8 +5103,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.test('Test navigateToRow method if virtualScrolling', function(assert) {
- let keyboardController;
-
// arrange
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
@@ -5250,7 +5131,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
assert.equal(this.pageIndex(), 0, 'Page index');
assert.equal(keyboardController.getVisibleRowIndex(), undefined, 'Focused row index');
@@ -5307,8 +5188,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.test('Focused row should preserve on navigation to the other row in infinite scrolling mode if page not loaded', function(assert) {
// arrange
- let rowsView;
-
this.data = [
{ name: 'Alex', phone: '111111', room: 6 },
{ name: 'Dan', phone: '2222222', room: 5 },
@@ -5336,7 +5215,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.setupModule();
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
rowsView.height(100);
rowsView.resize();
this.clock.tick();
@@ -5350,8 +5229,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('If editing in row edit mode and focusedRowEnabled - focusOverlay should render for the editing row', function(assert) {
- let rowsView;
-
// arrange
this.options = {
keyExpr: 'name',
@@ -5375,7 +5252,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.gridView.component.editRow(1);
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
$(rowsView.getRow(1).find('td').eq(0)).trigger(pointerEvents.up).click();
@@ -5386,8 +5263,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.testInActiveWindow('If editing in cell edit mode and focusedRowEnabled - focusOverlay should render for the editing row', function(assert) {
- let rowsView;
-
// arrange
this.options = {
keyExpr: 'name',
@@ -5409,7 +5284,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// act
this.editCell(1, 1);
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
$(rowsView.getRow(1).find('td').eq(1)).trigger(pointerEvents.up).click();
this.clock.tick();
@@ -5472,7 +5347,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('DataGrid should not focus adaptive rows', function(assert) {
// arrange
- let rowsView;
let focusedRowChangingCount = 0;
let focusedRowChangedCount = 0;
@@ -5497,7 +5371,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
// act
this.expandRow('Dan');
this.clock.tick();
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
$(rowsView.getRow(2).find('td').first()).trigger(pointerEvents.up).click();
// assert
@@ -5507,7 +5381,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('DataGrid should reset focused row if focusedRowKey is set to undefined', function(assert) {
// arrange
- let rowsView;
let focusedRowChangedCallsCount = 0;
this.options = {
@@ -5525,7 +5398,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// assert
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
assert.ok($(rowsView.getRow(1)).hasClass('dx-row-focused'), 'focused row');
assert.equal(this.keyboardNavigationController._focusedCellPosition.rowIndex, this.option('focusedRowIndex'), 'Keyboard navigation focused row index');
@@ -5561,8 +5434,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('DataGrid should reset focused row if focusedRowIndex is set to < 0', function(assert) {
// arrange
- let rowsView;
-
this.options = {
keyExpr: 'name',
focusedRowEnabled: true,
@@ -5575,7 +5446,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
// assert
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
assert.ok($(rowsView.getRow(1)).hasClass('dx-row-focused'), 'focused row');
assert.ok(this.option('focusedRowKey'), 'focusedRowKey');
@@ -5689,8 +5560,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
QUnit.testInActiveWindow('DataGrid - click by cell should not generate exception if rowTemplate is used (T800604)', function(assert) {
let d = $.Deferred();
- let rowsView;
- let keyboardController;
const items = generateItems(1);
// arrange
@@ -5722,11 +5591,11 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
this.clock.tick();
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
rowsView.height(100);
rowsView.resize();
- keyboardController = this.getController('keyboardNavigation');
+ const keyboardController = this.getController('keyboardNavigation');
keyboardController._focusedView = rowsView;
// act
@@ -5741,8 +5610,6 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
});
QUnit.test('autoNavigateToFocusedRow == false and focusedRowKey', function(assert) {
- let rowsView;
-
// arrange
this.options = {
height: 100,
@@ -5766,7 +5633,7 @@ QUnit.module('FocusedRow with real dataController, keyboard and columnsControlle
addOptionChangedHandlers(this);
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
rowsView.height(100);
rowsView.resize();
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js
index 88470b78c871..f3d403bed9b8 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/gridView.tests.js
@@ -377,7 +377,7 @@ function createGridView(options, userOptions) {
headers = testElement.find('.dx-datagrid-headers');
// assert
- assert.ok(headers.length === 0, 'headers are hidden');
+ assert.strictEqual(headers.length, 0, 'headers are hidden');
});
QUnit.test('Hide borders by default', function(assert) {
@@ -450,7 +450,7 @@ function createGridView(options, userOptions) {
headers = testElement.find('.dx-datagrid-headers');
// assert
- assert.ok(headers.length === 0, 'headers are hidden');
+ assert.strictEqual(headers.length, 0, 'headers are hidden');
});
// B239207
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js
index f95eaf8be442..a79a0ebd0100 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/headerFilter.tests.js
@@ -1408,7 +1408,7 @@ QUnit.test('Indicator state when there is filterValues in the grouped column', f
$headerFilter = that.headerPanel.element().find('.dx-group-panel-item').first().find('.dx-header-filter');
assert.equal($headerFilter.length, 1, 'have header filter');
assert.ok(!$headerFilter.hasClass('dx-header-filter-empty'), 'has no class dx-header-filter-empty');
- assert.ok($headerFilter.css('color') === $headerFilter.parent().css('color'), 'color of the header should be as parent color');
+ assert.strictEqual($headerFilter.css('color'), $headerFilter.parent().css('color'), 'color of the header should be as parent color');
});
QUnit.test('Header filter popup should be shown on header filter icon click in groupPanel', function(assert) {
@@ -1509,7 +1509,7 @@ QUnit.test('Indicator state when there is no filterValues in the grouped column'
$headerFilter = that.headerPanel.element().find('.dx-group-panel-item').first().find('.dx-header-filter');
assert.equal($headerFilter.length, 1, 'have header filter');
assert.ok($headerFilter.hasClass('dx-header-filter-empty'), 'has no class dx-header-filter-empty');
- assert.ok($headerFilter.css('color') !== $headerFilter.parent().css('color'), 'color of the header filter should hava alpha');
+ assert.notStrictEqual($headerFilter.css('color'), $headerFilter.parent().css('color'), 'color of the header filter should hava alpha');
});
// T260241
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/headerPanel.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/headerPanel.tests.js
index fa210e099a68..3c9e74f5bc4a 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/headerPanel.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/headerPanel.tests.js
@@ -67,7 +67,7 @@ QUnit.test('Draw searchPanel', function(assert) {
searchPanel = testElement.find('.dx-datagrid-search-panel');
assert.strictEqual(input.length, 1);
- assert.ok(searchPanel.length === 1);
+ assert.strictEqual(searchPanel.length, 1);
assert.equal(searchPanel.outerWidth(), 160, 'search panel width');
});
@@ -356,7 +356,7 @@ QUnit.test('Enter text in searchPanel', function(assert) {
// assert
searchPanel = testElement.find('.dx-datagrid-search-panel');
- assert.ok(searchPanel.length === 1);
+ assert.strictEqual(searchPanel.length, 1);
searchPanel.dxTextBox('instance').option('value', '123');
assert.equal(this.option('searchPanel.text'), '123');
});
@@ -379,7 +379,7 @@ QUnit.test('Draw searchPanel custom width', function(assert) {
const input = testElement.find('input');
searchPanel = testElement.find('.dx-datagrid-search-panel');
assert.strictEqual(input.length, 1);
- assert.ok(searchPanel.length === 1);
+ assert.strictEqual(searchPanel.length, 1);
assert.equal(searchPanel.outerWidth(), 213, 'default search panel width');
});
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardController.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardController.tests.js
index f1ff651c1338..dc3292ffcc7f 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardController.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardController.tests.js
@@ -232,43 +232,39 @@ QUnit.module('Keyboard controller', {
QUnit.testInActiveWindow('Element of view is subscribed to events', function(assert) {
// arrange
const navigationController = new KeyboardNavigationController(this.component);
- let element;
// act
navigationController.init();
navigationController._focusView();
- element = navigationController.getFocusedView().element();
+
+ const element = navigationController.getFocusedView().element();
callViewsRenderCompleted(this.component._views);
// assert
- assert.equal(element.eventsInfo[eventUtils.addNamespace(pointerEvents.up, 'dxDataGridKeyboardNavigation')].subscribeToEventCounter, 1, 'Subscribed');
assert.equal(element.eventsInfo[eventUtils.addNamespace(pointerEvents.down, 'dxDataGridKeyboardNavigation')].subscribeToEventCounter, 1, 'Subscribed');
});
QUnit.testInActiveWindow('Element of view is unsubscribed from events', function(assert) {
// arrange
const navigationController = new KeyboardNavigationController(this.component);
- let element;
// act
navigationController.init();
navigationController._focusView();
- element = navigationController.getFocusedView().element();
+
+ const element = navigationController.getFocusedView().element();
callViewsRenderCompleted(this.component._views);
// assert
- assert.equal(element.eventsInfo[eventUtils.addNamespace(pointerEvents.up, 'dxDataGridKeyboardNavigation')].unsubscribeFromEventCounter, 1, 'Unsubscribed');
assert.equal(element.eventsInfo[eventUtils.addNamespace(pointerEvents.down, 'dxDataGridKeyboardNavigation')].unsubscribeFromEventCounter, 1, 'Unsubscribed');
});
// T579521
QUnit.testInActiveWindow('Master detail cell is not focused when clicked on self', function(assert) {
// arrange
- let navigationController;
let isFocused = false;
- let $masterDetailCell;
const $rowsElement = $('
').append($('
| |
')).appendTo('#container');
this.getView('rowsView').element = function() {
@@ -276,12 +272,12 @@ QUnit.module('Keyboard controller', {
};
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
callViewsRenderCompleted(this.component._views);
- $masterDetailCell = $rowsElement.find('td')[0];
+ const $masterDetailCell = $rowsElement.find('td')[0];
$masterDetailCell.focus = function() {
isFocused = true;
@@ -296,18 +292,16 @@ QUnit.module('Keyboard controller', {
// T281701
QUnit.testInActiveWindow('Cell is not focused when clicked it in another grid', function(assert) {
// arrange
- let navigationController;
let isFocused = false;
- let $cell;
const $rowsElement = $('
').addClass('.dx-datagrid').append($('
')).appendTo('#container');
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
callViewsRenderCompleted(this.component._views);
- $cell = $rowsElement.find('td')[0];
+ const $cell = $rowsElement.find('td')[0];
$cell.focus = function() {
isFocused = true;
@@ -362,8 +356,6 @@ QUnit.module('Keyboard controller', {
QUnit.testInActiveWindow('Interactive element is focused when edit mode is enabled (T403964)', function(assert) {
// arrange
- let navigationController;
- let view;
const $rowsElement = $('
').appendTo('#container').append($(`
"
|
@@ -373,7 +365,7 @@ QUnit.module('Keyboard controller', {
|
`));
- view = this.getView('rowsView');
+ const view = this.getView('rowsView');
view.element = function() {
return $rowsElement;
};
@@ -381,7 +373,7 @@ QUnit.module('Keyboard controller', {
// act
$('.dx-row .cell-0').focus();
this.component._controllers.editing._isEditing = true;
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
navigationController._focusedView = view;
@@ -415,7 +407,6 @@ QUnit.module('Keyboard controller', {
QUnit.testInActiveWindow('View is not focused when row is inline edited', function(assert) {
// arrange
- let navigationController;
let isFocused = false;
const $rowsElement = $('
');
@@ -427,7 +418,7 @@ QUnit.module('Keyboard controller', {
};
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController._hasInput = function() {
return true;
};
@@ -446,7 +437,6 @@ QUnit.module('Keyboard controller', {
QUnit.testInActiveWindow('Focus by click is not applied when editing is enabled (T311207)', function(assert) {
// arrange
- let navigationController;
let isViewFocused = false;
const $rowsViewElement = $('
').append($('
')).appendTo('#container');
const rowsView = this.getView('rowsView');
@@ -456,7 +446,7 @@ QUnit.module('Keyboard controller', {
};
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
navigationController._focusedView = rowsView;
@@ -666,9 +656,7 @@ QUnit.module('Keyboard controller', {
QUnit.testInActiveWindow('Cell is not focused when view is renderCompleted without keydown event', function(assert) {
// arrange
- let navigationController;
let isFocused = false;
- let $cell;
const rowsView = this.getView('rowsView');
const $rowsElement = $('
').append($('
'));
@@ -677,14 +665,14 @@ QUnit.module('Keyboard controller', {
};
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
navigationController._focusedView = rowsView;
navigationController._focus = function() {
isFocused = true;
};
- $cell = $rowsElement.find('td').eq(0);
+ const $cell = $rowsElement.find('td').eq(0);
$($cell).trigger(CLICK_EVENT);
@@ -698,7 +686,6 @@ QUnit.module('Keyboard controller', {
QUnit.test('Element is not focused when it is html tag is not cell', function(assert) {
// arrange
- let navigationController;
let _$focusElement;
const rowsView = this.getView('rowsView');
const $rowsElement = $('
').append($('
'));
@@ -711,7 +698,7 @@ QUnit.module('Keyboard controller', {
};
// act
- navigationController = new KeyboardNavigationController(this.component);
+ const navigationController = new KeyboardNavigationController(this.component);
navigationController.init();
navigationController._focusedView = rowsView;
navigationController._focus($('
'));
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js
index e191b7b097d0..588a3e5929b1 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.keyboardKeys.tests.js
@@ -283,43 +283,6 @@ QUnit.module('Keyboard keys', {
assert.strictEqual(this.dataController.expandRow.callCount, 0, 'grid does not open master detail');
});
- /* test("Down arrow for master detail", function () {
- // act
- this.options.masterDetail = {
- enabled: true,
- template: function(container){
- $(container).append($("
").text("TEST"));
- }
- };
- this.gridView.render($("#container"));
- this.focusFirstCell();
- this.triggerKeyDown("rightArrow")
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
-
- // assert
- assert.equal(this.keyboardNavigationController._focusedCellPosition.columnIndex, 1, "cellIndex");
- assert.equal(this.keyboardNavigationController._focusedCellPosition.rowIndex, 5, "rowIndex");
- });
-
- QUnit.testInActiveWindow("Up arrow for master detail", function (assert) {
- // act
- this.gridView.render($("#container"));
-
- this.focusFirstCell();
-
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
- this.triggerKeyDown("downArrow");
-
- // assert
- assert.equal(this.keyboardNavigationController._focusedCellPosition.columnIndex, 0, "cellIndex");
- assert.equal(this.keyboardNavigationController._focusedCellPosition.rowIndex, 2, "rowIndex");
- }); */
-
QUnit.testInActiveWindow('Update focus when row is editing with form_T306378', function(assert) {
// arrange
this.$element = function() {
@@ -1844,7 +1807,6 @@ QUnit.module('Keyboard keys', {
const $container = $('#container');
let isStoreUpdated;
- let $input;
this.$element = function() {
return $container;
@@ -1871,7 +1833,7 @@ QUnit.module('Keyboard keys', {
this.triggerKeyDown('enter');
this.clock.tick();
- $input = $('.dx-row input').eq(1);
+ const $input = $('.dx-row input').eq(1);
assert.ok($input.length, 'input found');
$input.val('Test update cell');
@@ -1945,7 +1907,6 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('Escape for cancel row editing', function(assert) {
// arrange
const $container = $('#container');
- let isPreventDefaultCalled;
setupModules(this);
@@ -1958,7 +1919,8 @@ QUnit.module('Keyboard keys', {
this.triggerKeyDown('enter');
this.keyboardNavigationController._focusedCellPosition = null;
- isPreventDefaultCalled = this.triggerKeyDown('escape', false, false, $container.find('input')[0]).preventDefault;
+
+ const isPreventDefaultCalled = this.triggerKeyDown('escape', false, false, $container.find('input')[0]).preventDefault;
// assert
assert.ok(isPreventDefaultCalled, 'PreventDefault');
@@ -2073,7 +2035,6 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('Edit cell should not lose focus after enter key', function(assert) {
let inputBlurFired = false;
let inputChangeFired = false;
- let $input;
// arrange
setupModules(this);
@@ -2089,7 +2050,7 @@ QUnit.module('Keyboard keys', {
this.clock.tick();
// arrange
- $input = dataGridWrapper.rowsView.getEditorInput(0, 0);
+ const $input = dataGridWrapper.rowsView.getEditorInput(0, 0);
// assert
assert.ok($input.is(':focus'), 'input is focused');
@@ -2252,8 +2213,6 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('DataGrid should skip group rows after tab navigation from the editing cell (T714142, T715092)', function(assert) {
// arrange
- let $cell;
-
this.columns = [
{ visible: true, command: 'expand' },
{ caption: 'Column 1', visible: true, dataField: 'Column1', allowEditing: true },
@@ -2288,7 +2247,7 @@ QUnit.module('Keyboard keys', {
this.editCell(0, 1);
this.clock.tick();
- $cell = $('#container').find('.dx-data-row').eq(0).find('td:nth-child(2)').eq(0);
+ const $cell = $('#container').find('.dx-data-row').eq(0).find('td:nth-child(2)').eq(0);
// assert
assert.ok(this.editingController.isEditing(), 'is editing');
@@ -2644,8 +2603,8 @@ QUnit.module('Keyboard keys', {
// act
- const $cell = $(this.rowsView.element()).find('.dx-row').filter(':visible').eq(0).find('td').eq(0);
- $cell.focus().trigger(pointerEvents.up);
+ let $cell = $(this.rowsView.getCellElement(0, 0));
+ $cell.focus().trigger(CLICK_EVENT);
let isPreventDefaultCalled = this.triggerKeyDown('tab', false, false, $cell).preventDefault;
@@ -2664,8 +2623,9 @@ QUnit.module('Keyboard keys', {
isPreventDefaultCalled = this.triggerKeyDown('tab', false, false, $link2).preventDefault;
// assert
+ $cell = $(this.rowsView.getCellElement(0, 2));
assert.ok(isPreventDefaultCalled, 'preventDefault is called');
- assert.ok(this.rowsView.element().find('.dx-row').filter(':visible').eq(0).find('td').eq(2).is(':focus'), 'last cell is focused');
+ assert.ok($cell.is(':focus'), 'last cell is focused');
});
// T342637
@@ -2704,8 +2664,10 @@ QUnit.module('Keyboard keys', {
// act
- const $cell = $(this.rowsView.element()).find('.dx-row').filter(':visible').eq(0).find('td').eq(2);
- $cell.focus().trigger(pointerEvents.up);
+ let $cell = $(this.rowsView.getCellElement(0, 2));
+ $cell
+ .focus()
+ .trigger(CLICK_EVENT);
let isPreventDefaultCalled = this.triggerKeyDown('tab', false, true, $cell).preventDefault;
this.clock.tick();
@@ -2728,8 +2690,9 @@ QUnit.module('Keyboard keys', {
this.clock.tick();
// assert
+ $cell = $(this.rowsView.getCellElement(0, 0));
assert.ok(isPreventDefaultCalled, 'preventDefault is called');
- assert.ok(this.rowsView.element().find('.dx-row').filter(':visible').eq(0).find('td').eq(0).is(':focus'), 'first cell is focused');
+ assert.ok($cell.is(':focus'), 'first cell is focused');
assert.ok($('#container .dx-datagrid-focus-overlay').is(':visible'), 'focus overlay is visible');
});
@@ -2762,8 +2725,8 @@ QUnit.module('Keyboard keys', {
// act
- const $cell = $(this.rowsView.element()).find('.dx-row').filter(':visible').eq(0).find('td').eq(0);
- $cell.focus().trigger(pointerEvents.up);
+ const $cell = $(this.rowsView.getCellElement(0, 0));
+ $cell.focus().trigger(CLICK_EVENT);
const isPreventDefaultCalled = this.triggerKeyDown('tab', false, false, $cell).preventDefault;
this.clock.tick();
@@ -2830,8 +2793,6 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('Edit next cell after tab key when edit disabled and row edited via API', function(assert) {
// arrange
- let $editRow;
-
setupModules(this);
this.keyboardNavigationController._focusedView = this.rowsView;
@@ -2840,7 +2801,8 @@ QUnit.module('Keyboard keys', {
this.editingController.editRow(0);
this.clock.tick();
- $editRow = $('#container').find('.dx-data-row').first();
+
+ const $editRow = $('#container').find('.dx-data-row').first();
assert.equal(this.editingController._editRowIndex, 0, 'edit row index');
@@ -2857,8 +2819,6 @@ QUnit.module('Keyboard keys', {
if(device.deviceType === 'desktop') {
QUnit.testInActiveWindow('Focus on first cell when insert Row', function(assert) {
- let $newRow;
-
setupModules(this);
this.keyboardNavigationController._focusedView = this.rowsView;
@@ -2872,7 +2832,7 @@ QUnit.module('Keyboard keys', {
this.editingController.addRow();
this.clock.tick();
- $newRow = $('#container').find('.dx-data-row').first();
+ const $newRow = $('#container').find('.dx-data-row').first();
assert.equal(this.editingController._editRowIndex, 0, 'edit row index');
assert.ok($newRow.find('input').first().parents('.dx-editor-cell').hasClass('dx-focused'));
@@ -2888,8 +2848,6 @@ QUnit.module('Keyboard keys', {
});
QUnit.testInActiveWindow('Focus on first cell when insert Row via API when not editing', function(assert) {
- let $newRow;
-
setupModules(this);
this.keyboardNavigationController._focusedView = this.rowsView;
@@ -2902,7 +2860,8 @@ QUnit.module('Keyboard keys', {
this.editingController.addRow();
this.clock.tick();
- $newRow = $('#container').find('.dx-data-row').first();
+
+ const $newRow = $('#container').find('.dx-data-row').first();
assert.equal(this.editingController._editRowIndex, 0, 'edit row index');
assert.ok($newRow.find('input').first().parents('.dx-editor-cell').hasClass('dx-focused'));
@@ -3238,7 +3197,6 @@ QUnit.module('Keyboard keys', {
// act
const $container = $('#container');
- let $groupRow;
this.gridView.render($container);
@@ -3248,7 +3206,7 @@ QUnit.module('Keyboard keys', {
this.clock.tick();
// assert
- $groupRow = $container.find('.dx-group-row').first();
+ const $groupRow = $container.find('.dx-group-row').first();
assert.ok($groupRow.attr('tabindex'), 'tab index');
});
@@ -3318,9 +3276,13 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('Enter on grouped row with isContinuation is true, is not worked', function(assert) {
// arrange
+ this.options = {
+ grouping: { allowCollapsing: true },
+ editing: {}
+ };
+
setupModules(this);
- this.options = { grouping: { allowCollapsing: true }, editing: {} };
this.keyboardNavigationController._focusedView = this.rowsView;
this.keyboardNavigationController._focusedCellPosition = {
@@ -3818,9 +3780,6 @@ QUnit.module('Keyboard keys', {
// T680076
QUnit.testInActiveWindow('Down arrow key should work correctly after page down key press', function(assert) {
// arrange
- let scrollable;
- let $scrollContainer;
-
this.dataControllerOptions = {
pageCount: 4,
pageIndex: 0,
@@ -3844,8 +3803,8 @@ QUnit.module('Keyboard keys', {
this.gridView.render($('#container'));
this.rowsView.height(70);
this.rowsView.resize();
- scrollable = this.rowsView.getScrollable();
- $scrollContainer = $(scrollable._container());
+ const scrollable = this.rowsView.getScrollable();
+ const $scrollContainer = $(scrollable._container());
this.focusFirstCell();
@@ -3866,8 +3825,6 @@ QUnit.module('Keyboard keys', {
QUnit.testInActiveWindow('DataGrid should not scroll back to the focused editing cell after append rows in virtual scrolling (T715091)', function(assert) {
// arrange
- let $cell;
-
this.dataControllerOptions = {
pageCount: 4,
pageIndex: 0,
@@ -3902,7 +3859,7 @@ QUnit.module('Keyboard keys', {
this.clock.tick();
// act
- $cell = $(this.getCellElement(0, 0));
+ const $cell = $(this.getCellElement(0, 0));
this.triggerKeyDown('tab', false, false, $cell);
this.keyboardNavigationController._updateFocus = function() {
// assert
@@ -3937,11 +3894,10 @@ QUnit.module('Keyboard keys', {
that.rowsView.height(400);
that.rowsView.resize();
- this.focusCell(0, 1); // focus the first cell of the first data row
+ this.focusCell(0, 0); // focus the first cell of the first data row
that.clock.tick();
// act
-
this.triggerKeyDown('upArrow');
$(that.rowsView.getScrollable()._container()).trigger('scroll');
that.clock.tick();
@@ -3958,9 +3914,6 @@ QUnit.module('Keyboard keys', {
// T680076
QUnit.testInActiveWindow('The page must be correct after several the \'Page Down\' key presses', function(assert) {
// arrange
- let scrollable;
- let $scrollContainer;
-
this.options = {
dataSource: generateItems(10),
scrolling: {
@@ -3976,8 +3929,8 @@ QUnit.module('Keyboard keys', {
this.gridView.render($('#container'));
this.rowsView.height(70);
this.rowsView.resize();
- scrollable = this.rowsView.getScrollable();
- $scrollContainer = $(scrollable._container());
+ const scrollable = this.rowsView.getScrollable();
+ const $scrollContainer = $(scrollable._container());
this.focusFirstCell();
this.clock.tick();
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.realControllers.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.realControllers.tests.js
index 0356727be743..3f21e17ff801 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.realControllers.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/keyboardNavigation.realControllers.tests.js
@@ -75,10 +75,6 @@ QUnit.module('Real DataController and ColumnsController', {
}, function() {
QUnit.testInActiveWindow('Must navigate after click by expand column of master detail', function(assert) {
// arrange
- let keyboardController;
- let rowsView;
- let $expandCell;
-
this.options = {
masterDetail: {
enabled: true,
@@ -94,9 +90,9 @@ QUnit.module('Real DataController and ColumnsController', {
this.gridView.render($('#container'));
this.clock.tick();
- keyboardController = this.getController('keyboardNavigation');
- rowsView = this.gridView.getView('rowsView');
- $expandCell = $(rowsView.element().find('td').first());
+ const keyboardController = this.getController('keyboardNavigation');
+ const rowsView = this.gridView.getView('rowsView');
+ const $expandCell = $(rowsView.element().find('td').first());
// act
$expandCell.trigger(CLICK_EVENT);
@@ -118,11 +114,9 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Cell is focused when clicked on self', function(assert) {
// arrange
- let $cell;
-
this.setupAndRender();
- $cell = $(this.getCellElement(1, 1));
+ const $cell = $(this.getCellElement(1, 1));
$cell.trigger(CLICK_EVENT);
// assert
@@ -131,9 +125,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Cell is focused when clicked on input in cell (T667278)', function(assert) {
// arrange
- let $cell;
- let $input;
-
this.options = {
columns: [
'name', {
@@ -147,9 +138,9 @@ QUnit.module('Real DataController and ColumnsController', {
this.setupAndRender();
// act
- $input = $(this.getCellElement(1, 1)).find('input');
+ const $input = $(this.getCellElement(1, 1)).find('input');
$input.focus().trigger(CLICK_EVENT);
- $cell = $input.parent();
+ const $cell = $input.parent();
// assert
assert.ok($input.is(':focus'), 'input is focused');
@@ -159,19 +150,16 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Cell is not focused when clicked on invalid self', function(assert) {
// arrange
- let navigationController;
- let $cell;
-
this.setupAndRender();
// act
- navigationController = this.getController('keyboardNavigation');
+ const navigationController = this.getController('keyboardNavigation');
navigationController._isCellValid = () => false;
navigationController._focusedCellPosition = { columnIndex: 0, rowIndex: 0 };
navigationController._isNeedFocus = true;
// arrange
- $cell = $(this.getCellElement(1, 1));
+ const $cell = $(this.getCellElement(1, 1));
$cell.trigger(CLICK_EVENT);
// assert
@@ -182,9 +170,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Focus valid cell in a rows with data', function(assert) {
// arrange
- let navigationController;
- let rowsView;
-
this.options = {
editing: {
mode: 'cell',
@@ -197,8 +182,8 @@ QUnit.module('Real DataController and ColumnsController', {
$(this.getCellElement(1, 1)).trigger(CLICK_EVENT);
this.clock.tick();
- navigationController = this.getController('keyboardNavigation');
- rowsView = this.getView('rowsView');
+ const navigationController = this.getController('keyboardNavigation');
+ const rowsView = this.getView('rowsView');
navigationController.getFocusedView = () => rowsView;
navigationController._editingController.isEditing = () => true;
navigationController._isNeedFocus = true;
@@ -211,8 +196,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Only visible input element is focused when edit mode is enabled (T403964)', function(assert) {
// arrange
- let navigationController;
-
this.options = {
editing: {
mode: 'row',
@@ -235,7 +218,7 @@ QUnit.module('Real DataController and ColumnsController', {
this.setupAndRender();
// arrange
- navigationController = this.getController('keyboardNavigation');
+ const navigationController = this.getController('keyboardNavigation');
// act
this.editRow(1);
@@ -330,8 +313,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('Master-detail cell should not has tabindex', function(assert) {
// arrange
- let masterDetailCell;
-
this.$element = function() {
return $('#container');
};
@@ -354,7 +335,8 @@ QUnit.module('Real DataController and ColumnsController', {
this.option('focusedRowIndex', 1);
this.getView('rowsView').renderFocusState();
- masterDetailCell = $(this.gridView.getView('rowsView').element().find('.dx-master-detail-cell').eq(0));
+
+ const masterDetailCell = $(this.gridView.getView('rowsView').element().find('.dx-master-detail-cell').eq(0));
// assert
assert.notOk(masterDetailCell.attr('tabindex'), 'master-detail cell has no tabindex');
@@ -382,8 +364,8 @@ QUnit.module('Real DataController and ColumnsController', {
// act
const $cell = $(this.getCellElement(0, 1));
- $cell.trigger(pointerEvents.up);
- $cell.trigger(pointerEvents.up);
+ $cell.trigger(CLICK_EVENT);
+ $cell.trigger(CLICK_EVENT);
// assert
assert.equal($(this.getCellElement(0, 1)).attr('tabIndex'), 0, 'cell has tab index');
@@ -421,7 +403,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('DataGrid should not moved back to the edited cell if the next clicked cell canceled editing process (T718459, T812546)', function(assert) {
// arrange
- let keyboardNavigationController;
let editingStartFiresCount = 0;
let focusedCellChangingFiresCount = 0;
let focusedCellChangedFiresCount = 0;
@@ -450,7 +431,7 @@ QUnit.module('Real DataController and ColumnsController', {
// act
this.gridView.render($('#container'));
- keyboardNavigationController = this.gridView.component.keyboardNavigationController;
+ const keyboardNavigationController = this.gridView.component.keyboardNavigationController;
$cell = $(this.getCellElement(1, 1));
$cell.trigger(CLICK_EVENT);
this.editCell(1, 1);
@@ -486,8 +467,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('DataGrid should preserve fosused overlay after cancel editing (T812546)', function(assert) {
// arrange
let editingStartFiresCount = 0;
- let keyboardNavigation;
-
this.$element = () => $('#container');
this.options = {
@@ -505,11 +484,12 @@ QUnit.module('Real DataController and ColumnsController', {
};
this.setupModule();
- keyboardNavigation = this.getController('keyboardNavigation');
+
+ const keyboardNavigation = this.getController('keyboardNavigation');
// act
this.gridView.render($('#container'));
- $(this.getCellElement(1, 1)).trigger(pointerEvents.up);
+ $(this.getCellElement(1, 1)).trigger(CLICK_EVENT);
this.clock.tick();
this.triggerKeyDown('upArrow', false, false, $(':focus'));
this.clock.tick();
@@ -527,7 +507,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.testInActiveWindow('DataGrid should cancel editing cell if cell focusing canceled (T718459)', function(assert) {
// arrange
- let keyboardNavigationController;
let editingStartCount = 0;
let focusedCellChangingFiresCount = 0;
let focusedCellChangedFiresCount = 0;
@@ -558,7 +537,7 @@ QUnit.module('Real DataController and ColumnsController', {
// act
this.gridView.render($('#container'));
- keyboardNavigationController = this.gridView.component.keyboardNavigationController;
+ const keyboardNavigationController = this.gridView.component.keyboardNavigationController;
$cell = $(this.rowsView.element().find('.dx-row').eq(1).find('td').eq(1));
$cell.trigger(CLICK_EVENT);
this.editCell(1, 1);
@@ -633,7 +612,7 @@ QUnit.module('Real DataController and ColumnsController', {
// act
this.refresh();
// assert
- assert.equal(focusedRowChangedFiresCount, 2, 'onFocusedRowChanged fires count');
+ assert.equal(focusedRowChangedFiresCount, 1, 'onFocusedRowChanged fires count');
});
// T804439
@@ -655,7 +634,8 @@ QUnit.module('Real DataController and ColumnsController', {
// act
$(this.getCellElement(0, 0))
- .trigger('dxpointerup')
+ .trigger(CLICK_EVENT)
+ .trigger(pointerEvents.up)
.trigger('dxclick');
// assert
@@ -693,9 +673,6 @@ QUnit.module('Real DataController and ColumnsController', {
});
QUnit.testInActiveWindow('Focus must be after enter key pressed if \'cell\' edit mode (T653709)', function(assert) {
- let rowsView;
- let $cell;
-
// arrange
this.$element = function() {
return $('#container');
@@ -714,7 +691,7 @@ QUnit.module('Real DataController and ColumnsController', {
// arrange
this.gridView.render($('#container'));
- rowsView = this.gridView.getView('rowsView');
+ const rowsView = this.gridView.getView('rowsView');
// act
this.editCell(0, 1);
@@ -723,7 +700,7 @@ QUnit.module('Real DataController and ColumnsController', {
this.gridView.component.editorFactoryController._$focusedElement = undefined;
this.clock.tick();
- $cell = $(this.rowsView.element().find('.dx-data-row:nth-child(1) td:nth-child(2)'));
+ const $cell = $(this.rowsView.element().find('.dx-data-row:nth-child(1) td:nth-child(2)'));
// assert
assert.ok($cell.hasClass('dx-focused'), 'cell is focused');
@@ -815,7 +792,7 @@ QUnit.module('Real DataController and ColumnsController', {
const rowsView = this.gridView.getView('rowsView');
const $expandCell = $(rowsView.element().find('td').first());
- $expandCell.trigger(pointerEvents.up);
+ $expandCell.trigger(CLICK_EVENT);
this.clock.tick();
@@ -1092,7 +1069,6 @@ QUnit.module('Real DataController and ColumnsController', {
// arrange
const that = this;
- let $testElement;
that.$element = function() {
return $('#container');
@@ -1119,7 +1095,7 @@ QUnit.module('Real DataController and ColumnsController', {
that.gridView.render($('#container'));
// arrange, act
- $testElement = that.$element().find('.template td').eq(0);
+ const $testElement = that.$element().find('.template td').eq(0);
$testElement.find('input').focus();
$testElement.trigger(CLICK_EVENT);
@@ -1133,7 +1109,6 @@ QUnit.module('Real DataController and ColumnsController', {
QUnit.test('After apply the edit value with the ENTER key do not display the revert button when the save process, if editing mode is cell (T657148)', function(assert) {
// arrange
const that = this;
- let $input;
that.$element = function() {
return $('#container');
@@ -1165,7 +1140,7 @@ QUnit.module('Real DataController and ColumnsController', {
that.editCell(0, 0);
that.clock.tick();
- $input = $(that.getCellElement(0, 0)).find('input');
+ const $input = $(that.getCellElement(0, 0)).find('input');
$input.val('test').trigger('change');
that.clock.tick();
@@ -1274,4 +1249,98 @@ QUnit.module('Real DataController and ColumnsController', {
assert.strictEqual($testElement.find('.dx-datagrid-rowsview td').eq(2).text(), 'Bob John', 'text of the third column of the first row');
assert.ok(that.editingController.isEditCell(1, 0), 'the first cell of the second row is editable');
});
+
+ ['click', 'dblClick'].forEach(startEditAction => {
+ ['cell', 'batch'].forEach(editMode => {
+ QUnit.test(`Focus overlay should not be hidden after click the save editor cell if editing.mode: ${editMode}, editing.startEditAction is ${startEditAction}`, function(assert) {
+ // arrange
+ const $testElement = $('#container');
+
+ this.data = [{ name: 'Alex', lastName: 'John' }],
+ this.options = {
+ editing: {
+ allowUpdating: true,
+ mode: editMode,
+ startEditAction: startEditAction
+ }
+ };
+
+ this.setupModule();
+ this.gridView.render($testElement);
+
+ const editingController = this.getController('editing');
+ const startEditClickEventName = startEditAction === 'click' ? 'dxclick' : 'dxdblclick';
+
+ // act
+ $(this.getCellElement(0, 1)).trigger(startEditClickEventName);
+ this.clock.tick();
+ // assert
+ assert.ok(editingController.isEditCell(0, 1), 'Cell[0, 1] is in edit mode');
+
+ // act
+ $(this.getCellElement(0, 1)).trigger(CLICK_EVENT);
+ // assert
+ assert.ok(editingController.isEditCell(0, 1), 'Cell[0, 1] is in edit mode');
+ assert.notOk($(this.getCellElement(0, 1)).hasClass('dx-cell-focus-disabled'), 'Cell[0, 1] focus overlay is not disabled');
+ });
+
+ QUnit.test(`Click by command select cell should not highlight focus if editing.mode: ${editMode}, editing.startEditAction is ${startEditAction}`, function(assert) {
+ // arrange
+ const rowsViewWrapper = dataGridWrapper.rowsView;
+ const $testElement = $('#container');
+
+ this.data = [{ name: 'Alex', lastName: 'John' }],
+ this.options = {
+ loadingTimeout: undefined,
+ selection: {
+ mode: 'multiple',
+ showCheckBoxesMode: 'always'
+ },
+ editing: {
+ allowUpdating: true,
+ mode: editMode,
+ startEditAction: startEditAction
+ }
+ };
+
+ this.setupModule();
+ this.gridView.render($testElement);
+
+ // act
+ const $selectCell = rowsViewWrapper.getCellElement(0, 0);
+ $selectCell
+ .focus()
+ .removeClass('dx-cell-focus-disabled');
+ this.getController('editorFactory')._updateFocusCore();
+ this.clock.tick();
+
+ $selectCell
+ .trigger(pointerEvents.down)
+ .trigger(pointerEvents.up)
+ .trigger('dxclick');
+ this.clock.tick();
+
+ // assert
+ assert.notOk($selectCell.hasClass('dx-focused'), 'Cell has no .dx-focused');
+ assert.ok($selectCell.hasClass('dx-cell-focus-disabled'), 'Cell has disable focus class');
+
+ const $selectCheckBox = rowsViewWrapper.getSelectCheckBox(0, 0);
+ $selectCheckBox
+ .focus()
+ .removeClass('dx-cell-focus-disabled');
+ this.getController('editorFactory')._updateFocusCore();
+ this.clock.tick();
+
+ $selectCheckBox
+ .trigger(pointerEvents.down)
+ .trigger(pointerEvents.up)
+ .trigger('dxclick');
+ this.clock.tick();
+
+ // assert
+ assert.notOk($selectCell.hasClass('dx-focused'), 'Cell has no .dx-focused');
+ assert.ok($selectCell.hasClass('dx-cell-focus-disabled'), 'Cell has disable focus class');
+ });
+ });
+ });
});
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/pagerView.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/pagerView.tests.js
index 58991a43f9f3..81aa2e330bb9 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/pagerView.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/pagerView.tests.js
@@ -235,7 +235,7 @@ QUnit.test('Visible is changed from dataController', function(assert) {
this.dataController.updatePagesCount(20);
// assert
- assert.ok(testElement.find('.dx-pager').css('display') !== 'none', 'pager visible');
+ assert.notStrictEqual(testElement.find('.dx-pager').css('display'), 'none', 'pager visible');
});
QUnit.test('Pager is not rendered on partial update', function(assert) {
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/rowsView.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/rowsView.tests.js
index eee9fda12be9..f81d10d944d2 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/rowsView.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/rowsView.tests.js
@@ -85,7 +85,7 @@ function createRowsView(rows, dataController, columns, initDefaultOptions, userO
return true;
},
$element: function() {
- return $('.dx-datagrid');
+ return $('.dx-datagrid').parent();
}
};
@@ -1106,7 +1106,7 @@ QUnit.test('All rows are not isSelected by default', function(assert) {
rowsSelected = testElement.find('.dx-selection');
// assert
- assert.ok(rowsSelected.length === 0, 'rows are not isSelected by default');
+ assert.strictEqual(rowsSelected.length, 0, 'rows are not isSelected by default');
});
QUnit.test('Click on row call changeItemSelection', function(assert) {
@@ -3250,7 +3250,7 @@ QUnit.test('Rows with option rowAlternationEnabled true', function(assert) {
assert.ok(!rows.eq(0).hasClass('dx-row-alt'), 'not has class dx-row-alt');
assert.ok(rows.eq(1).hasClass('dx-row-alt'), 'has class dx-row-alt');
- assert.ok(rows.eq(1).find('td').css('backgroundColor') !== 'rgba(0, 0, 0, 0)', 'background color row');
+ assert.notStrictEqual(rows.eq(1).find('td').css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'background color row');
assert.ok(!rows.eq(2).hasClass('dx-row-alt'), 'not has class dx-row-alt');
});
@@ -3283,7 +3283,7 @@ QUnit.test('Rows with option rowAlternationEnabled true when grouping', function
assert.ok(!rows.eq(0).hasClass('dx-row-alt'), 'not has class dx-row-alt');
assert.ok(!rows.eq(1).hasClass('dx-row-alt'), 'not has class dx-row-alt');
assert.ok(rows.eq(2).hasClass('dx-row-alt'), 'has class dx-row-alt');
- assert.ok(rows.eq(2).find('td').css('backgroundColor') !== 'rgba(0, 0, 0, 0)', 'background color row');
+ assert.notStrictEqual(rows.eq(2).find('td').css('backgroundColor'), 'rgba(0, 0, 0, 0)', 'background color row');
});
QUnit.test('Rows with option rowAlternationEnabled false', function(assert) {
@@ -3808,7 +3808,7 @@ QUnit.test('Summary items are not displayed in a group row', function(assert) {
QUnit.test('Scroll to element by focus', function(assert) {
// arrange
- const testElement = $('#container');
+ const $testElement = $('#container');
const rowsView = this.createRowsView(this.items, null, null, null, {
keyboardNavigation: {
enabled: true
@@ -3818,16 +3818,18 @@ QUnit.test('Scroll to element by focus', function(assert) {
let isScrollTo;
const keyboardNavigationController = this.dataGrid.keyboardNavigationController;
- rowsView.render(testElement);
keyboardNavigationController._isNeedFocus = true;
keyboardNavigationController._isNeedScroll = true;
keyboardNavigationController._focusedView = rowsView;
+
+ rowsView.render($testElement);
+
rowsView._scrollable.scrollToElement = function() {
isScrollTo = true;
};
// act
- this.dataGrid.editorFactoryController.focus(testElement.find('.dx-data-row td').eq(0));
+ this.dataGrid.editorFactoryController.focus($testElement.find('.dx-data-row td').eq(0));
this.clock.tick(1);
// assert
diff --git a/testing/tests/DevExpress.ui.widgets.dataGrid/selection.tests.js b/testing/tests/DevExpress.ui.widgets.dataGrid/selection.tests.js
index 358905fa80ef..6a272ffe7bf4 100644
--- a/testing/tests/DevExpress.ui.widgets.dataGrid/selection.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.dataGrid/selection.tests.js
@@ -1335,7 +1335,7 @@ QUnit.test('redundant load after refresh when the grid restores its selection',
this.dataController.refresh();
const selectedRowsData = this.selectionController.getSelectedRowsData();
- assert.ok(oldSelectedRowsData !== selectedRowsData, 'selectedRowsData instance is changed');
+ assert.notStrictEqual(oldSelectedRowsData, selectedRowsData, 'selectedRowsData instance is changed');
assert.deepEqual(selectedRowsData, [{ name: 'Dan1', pay: 999 }, { name: 'Dan3', pay: 153 }]);
assert.equal(loadingCount, 1, 'one loading after refresh with selection');
});
diff --git a/testing/tests/DevExpress.ui.widgets.editors/actionButtons.test.js b/testing/tests/DevExpress.ui.widgets.editors/actionButtons.test.js
index 62991ce93148..bc15a2e8f993 100644
--- a/testing/tests/DevExpress.ui.widgets.editors/actionButtons.test.js
+++ b/testing/tests/DevExpress.ui.widgets.editors/actionButtons.test.js
@@ -929,7 +929,7 @@ module('collection updating', () => {
textBox.option('stylingMode', 'filled');
customButton = textBox.getButton('custom');
- assert.notOk(customButton.option('stylingMode') === 'text');
+ assert.notStrictEqual(customButton.option('stylingMode'), 'text');
});
});
diff --git a/testing/tests/DevExpress.ui.widgets.editors/calendar.markup.tests.js b/testing/tests/DevExpress.ui.widgets.editors/calendar.markup.tests.js
index 9910b50fa93a..665dc7da13c9 100644
--- a/testing/tests/DevExpress.ui.widgets.editors/calendar.markup.tests.js
+++ b/testing/tests/DevExpress.ui.widgets.editors/calendar.markup.tests.js
@@ -23,7 +23,7 @@ const toSelector = function(className) {
QUnit.module('Calendar markup', {
beforeEach: function() {
- this.$element = $('').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
this.calendar = this.$element.dxCalendar({
value: new Date(2013, 9, 15),
firstDayOfWeek: 1,
@@ -51,7 +51,7 @@ QUnit.module('Calendar markup', {
});
QUnit.test('Calendar must render with dx-rtl class', function(assert) {
- const $element = $('
').appendTo('body');
+ const $element = $('
').appendTo('#qunit-fixture');
$element.dxCalendar({
value: new Date(2013, 9, 15),
rtlEnabled: true
@@ -64,7 +64,7 @@ QUnit.module('Calendar markup', {
QUnit.module('Hidden input', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
this.calendar = this.$element.dxCalendar({
value: new Date(2013, 9, 15)
}).dxCalendar('instance');
@@ -94,7 +94,7 @@ QUnit.module('Hidden input', {
QUnit.module('The \'name\' option', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
},
afterEach: function() {
this.$element.remove();
@@ -113,7 +113,7 @@ QUnit.module('The \'name\' option', {
QUnit.module('Navigator', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
this.calendar = this.$element.dxCalendar({
value: new Date(2015, 5, 13)
}).dxCalendar('instance');
@@ -139,7 +139,7 @@ QUnit.module('Navigator', {
QUnit.module('Calendar footer', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
},
afterEach: function() {
this.$element.remove();
@@ -166,12 +166,12 @@ QUnit.module('Calendar footer', {
QUnit.module('CellTemplate option', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
this.calendar = this.$element.dxCalendar().dxCalendar('instance');
},
reinit: function(options) {
this.$element.remove();
- this.$element = $('
').appendTo('body');
+ this.$element = $('
').appendTo('#qunit-fixture');
this.calendar = this.$element.dxCalendar(options).dxCalendar('instance');
},
afterEach: function() {
@@ -232,19 +232,24 @@ QUnit.module('CellTemplate option', {
QUnit.module('Aria accessibility', {
beforeEach: function() {
- this.$element = $('
').appendTo('body');
+ this.$element = $('