Skip to content

Commit

Permalink
Merge branch '19_2' into cherry-pick-11645
Browse files Browse the repository at this point in the history
  • Loading branch information
San4es authored Jan 31, 2020
2 parents ef0cc2b + 92f2f67 commit 6e0241f
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 48 deletions.
6 changes: 0 additions & 6 deletions js/ui/date_box/ui.date_box.strategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ const DateBoxStrategy = Class.inherit({
this._widget && this._widget.option('value', this.dateBoxValue());
},

_valueChangedHandler: function(args) {
if(this.dateBox.option('opened') && this.dateBox.option('applyValueMode') === 'instantly') {
this.dateBoxValue(args.value);
}
},

useCurrentDateByDefault: noop,

getDefaultDate: function() {
Expand Down
2 changes: 1 addition & 1 deletion js/ui/date_box/ui.date_box.strategy.list.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ const ListStrategy = DateBoxStrategy.inherit({
date = new Date(year, month, day, hours, minutes, 0, 0);
}

this.dateBoxValue(date);
this.dateBoxValue(date, e.event);
},

attachKeyboardEvents: function(keyboardProcessor) {
Expand Down
1 change: 1 addition & 0 deletions testing/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"rules": {
"qunit/assert-args": "error",
"qunit/literal-compare-order": "error",
"qunit/no-arrow-tests": "error",
"qunit/no-setup-teardown": "error"
}
}
2 changes: 1 addition & 1 deletion testing/tests/DevExpress.serverSide/scheduler.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ QUnit.testStart(() => {

QUnit.module('View switcher server markup');

QUnit.test('View switcher tabs should be expanded on server', (assert) => {
QUnit.test('View switcher tabs should be expanded on server', function(assert) {
const scheduler = $('#scheduler').dxScheduler().dxScheduler('instance');
const $switcher = scheduler.$element().find('.dx-tabs.dx-scheduler-view-switcher');

Expand Down
17 changes: 17 additions & 0 deletions testing/tests/DevExpress.ui.widgets.editors/datebox.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3700,6 +3700,23 @@ QUnit.module('datebox w/ time list', {
$items.eq(3).trigger('dxclick');
assert.strictEqual($input.val(), $items.eq(3).text(), 'new time is applied');
});

QUnit.test('event field should be defined after value has been changed via List', function(assert) {
assert.expect(2);

this.dateBox.option({
opened: true,
onValueChanged: ({ event }) => {
assert.ok(!!event, 'event field is defined');
assert.strictEqual(event.type, 'dxclick');
}
});

$(this.dateBox.content())
.find('.dx-list-item')
.first()
.trigger('dxclick');
});
});

QUnit.module('keyboard navigation', {
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/DevExpress.ui.widgets.editors/lookup.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3141,7 +3141,7 @@ if(devices.real().deviceType === 'desktop') {
helper.$widget.remove();
}
}, () => {
QUnit.test(`opened: true, searchEnabled: ${searchEnabled}`, () => {
QUnit.test(`opened: true, searchEnabled: ${searchEnabled}`, function() {
helper.createWidget({ opened: true });

const $field = helper.$widget.find(`.${LOOKUP_FIELD_CLASS}`);
Expand All @@ -3166,7 +3166,7 @@ if(devices.real().deviceType === 'desktop') {
}
});

QUnit.test(`Opened: false, searchEnabled: ${searchEnabled}`, () => {
QUnit.test(`Opened: false, searchEnabled: ${searchEnabled}`, function() {
helper.createWidget({ opened: false });

const $field = helper.$widget.find(`.${LOOKUP_FIELD_CLASS}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,20 +284,20 @@ QUnit.module('Aria accessibility', {
helper.$widget.remove();
}
}, () => {
QUnit.test('Items: []', () => {
QUnit.test('Items: []', function() {
helper.createWidget({ });

helper.checkAttributes(helper.$widget, { role: 'radiogroup', tabindex: '0' }, 'widget');
});

QUnit.test('Items: [1, 2, 3], Item.selected: true', () => {
QUnit.test('Items: [1, 2, 3], Item.selected: true', function() {
helper.createWidget({ items: [1, 2, 3], value: 1 });

helper.checkAttributes(helper.$widget, { role: 'radiogroup', tabindex: '0' }, 'widget');
helper.checkItemsAttributes([0], { attributes: ['aria-selected', 'aria-checked'], role: 'radio' });
});

QUnit.test('Items: [1, 2, 3], Item.selected: true, set focusedElement -> clean focusedElement', () => {
QUnit.test('Items: [1, 2, 3], Item.selected: true, set focusedElement -> clean focusedElement', function() {
helper.createWidget({ items: [1, 2, 3], value: 1 });

helper.widget.option('focusedElement', helper.getItems().eq(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2450,7 +2450,7 @@ QUnit.module('editing', moduleSetup, () => {
assert.deepEqual(list.option('selectedItems'), [customValue], 'selected item is correct');
});

QUnit.test('onValueChanged event should have correct "event" field after adding a custom item', (assert) => {
QUnit.test('onValueChanged event should have correct "event" field after adding a custom item', function(assert) {
const valueChangedStub = sinon.stub();
const $selectBox = $('#selectBox').dxSelectBox({
acceptCustomValue: true,
Expand Down Expand Up @@ -2785,7 +2785,7 @@ QUnit.module('search', moduleSetup, () => {
assert.ok(selectBox.option('opened'), 'selectBox should be opened');
});

QUnit.testInActiveWindow('Filter should be canceled after focusout (T838753)', (assert) => {
QUnit.testInActiveWindow('Filter should be canceled after focusout (T838753)', function(assert) {
const items = ['111', '222', '333'];

const $selectBox = $('#selectBox').dxSelectBox({
Expand Down Expand Up @@ -5198,7 +5198,7 @@ if(devices.real().deviceType === 'desktop') {
helper.$widget.remove();
}
}, () => {
QUnit.test(`opened: true -> searchEnabled: ${!searchEnabled}`, () => {
QUnit.test(`opened: true -> searchEnabled: ${!searchEnabled}`, function() {
helper.createWidget({ opened: true });

helper.checkAttributes(helper.widget._list.$element(), { id: helper.widget._listId, 'aria-label': 'No data to display', role: 'listbox' }, 'list');
Expand Down Expand Up @@ -5240,7 +5240,7 @@ if(devices.real().deviceType === 'desktop') {
helper.checkAttributes(helper.widget._popup.$content(), { id: helper.widget._popupContentId }, 'popupContent');
});

QUnit.test(`opened: false -> searchEnabled: ${!searchEnabled}`, () => {
QUnit.test(`opened: false -> searchEnabled: ${!searchEnabled}`, function() {
helper.createWidget({ opened: false });

const inputAttributes = {
Expand Down
28 changes: 14 additions & 14 deletions testing/tests/DevExpress.ui.widgets/buttonGroup.selection.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
config = `, onInitial=${onInitialOption}, selectionMode=${selectionMode}`;

[null, undefined, []].forEach((selectedOptionValue) => {
QUnit.test(`${selectedOption}: ${selectedOptionValue}` + config, () => {
QUnit.test(`${selectedOption}: ${selectedOptionValue}` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand All @@ -115,7 +115,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
});
});

QUnit.test(`${selectedOption}: ['notExist']` + config, () => {
QUnit.test(`${selectedOption}: ['notExist']` + config, function() {
try {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);
if(selectedOption === 'selectedItems') {
Expand All @@ -129,7 +129,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: ['btn1']` + config, () => {
QUnit.test(`${selectedOption}: ['btn1']` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand All @@ -147,7 +147,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
helper.checkSelectedItems([items[0].id]);
});

QUnit.test(`${selectedOption}: ['btn2']` + config, () => {
QUnit.test(`${selectedOption}: ['btn2']` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -188,7 +188,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
helper.checkSelectedItems([items[0].id, items[1].id]);
});

QUnit.test(`${selectedOption}: [], click(btn1)` + config, () => {
QUnit.test(`${selectedOption}: [], click(btn1)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand All @@ -207,7 +207,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
helper.checkSelectedItems([items[0].id]);
});

QUnit.test(`${selectedOption}: [], click(btn2)` + config, () => {
QUnit.test(`${selectedOption}: [], click(btn2)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand All @@ -226,7 +226,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
helper.checkSelectedItems([items[1].id]);
});

QUnit.test(`${selectedOption}: [], click(btn1, btn2)` + config, () => {
QUnit.test(`${selectedOption}: [], click(btn1, btn2)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -256,7 +256,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: [], click(btn1, btn1)` + config, () => {
QUnit.test(`${selectedOption}: [], click(btn1, btn1)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -285,7 +285,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn1)` + config, () => {
QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn1)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -313,7 +313,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn2)` + config, () => {
QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn2)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -341,7 +341,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn1, btn2)` + config, () => {
QUnit.test(`${selectedOption}: [{ "text": "btn2" }], click(btn1, btn2)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -394,7 +394,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: ['btn1', 'btn2'], click(bnt2)` + config, () => {
QUnit.test(`${selectedOption}: ['btn1', 'btn2'], click(bnt2)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand All @@ -420,7 +420,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
}
});

QUnit.test(`${selectedOption}: ['btn1', 'btn2'], click(bnt2, btn1)` + config, () => {
QUnit.test(`${selectedOption}: ['btn1', 'btn2'], click(bnt2, btn1)` + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);

if(selectedOption === 'selectedItems') {
Expand Down Expand Up @@ -449,7 +449,7 @@ QUnit.module(`Selection for items: ${JSON.stringify(items)}, `, () => {
});
});

QUnit.test('KeyExpr: custom, set items: [], selectedItems[], click(btn1) -> click(btn3)' + config, () => {
QUnit.test('KeyExpr: custom, set items: [], selectedItems[], click(btn1) -> click(btn3)' + config, function() {
const helper = new ButtonGroupSelectionTestHelper(onInitialOption, selectionMode);
helper.createButtonGroup({
items: [
Expand Down
8 changes: 4 additions & 4 deletions testing/tests/DevExpress.ui.widgets/contextMenu.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1601,7 +1601,7 @@ QUnit.module('Aria accessibility', {
helper.$widget.remove();
}
}, () => {
QUnit.test('Items: [] -> show() -> hide()', () => {
QUnit.test('Items: [] -> show() -> hide()', function() {
helper.createWidget({ items: [] });
helper.checkAttributes(helper.$widget, { }, 'widget');
helper.checkItemsAttributes([], { });
Expand All @@ -1616,7 +1616,7 @@ QUnit.module('Aria accessibility', {
helper.checkItemsAttributes([], { });
});

QUnit.test('Items: [1, 2, 3] -> show() -> hide()', () => {
QUnit.test('Items: [1, 2, 3] -> show() -> hide()', function() {
helper.createWidget({ items: [1, 2, 3] });
helper.checkAttributes(helper.$widget, { }, 'widget');
helper.checkItemsAttributes([], { });
Expand All @@ -1631,7 +1631,7 @@ QUnit.module('Aria accessibility', {
helper.checkItemsAttributes([], { role: 'menuitem', tabindex: '-1' });
});

QUnit.test('Items: [1, 2, 3] -> set focusedElement: item[0] -> clean focusedElement', () => {
QUnit.test('Items: [1, 2, 3] -> set focusedElement: item[0] -> clean focusedElement', function() {
helper.createWidget({ items: [1, 2, 3] });
helper.checkAttributes(helper.$widget, { }, 'widget');
helper.checkItemsAttributes([], { });
Expand All @@ -1648,7 +1648,7 @@ QUnit.module('Aria accessibility', {
helper.checkItemsAttributes([], { role: 'menuitem', tabindex: '-1' });
});

QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement by keyboard on inner level', () => {
QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement by keyboard on inner level', function() {
helper.createWidget({
focusStateEnabled: true,
items: [{ text: 'Item1_1', items: [{ text: 'Item2_1' }, { text: 'Item2_2' }] }, { text: 'item1_2' }]
Expand Down
10 changes: 5 additions & 5 deletions testing/tests/DevExpress.ui.widgets/list.markup.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,15 +268,15 @@ if(devices.real().deviceType === 'desktop') {
helper.$widget.remove();
}
}, () => {
QUnit.test('Selected: [], selectionMode: "none"', () => {
QUnit.test('Selected: [], selectionMode: "none"', function() {
helper.createWidget();

helper.checkAttributes(searchEnabled ? helper.$itemContainer : helper.$widget, { role: 'listbox', tabindex: '0' });
helper.checkAttributes(searchEnabled ? helper.$widget : helper.$itemContainer, { });
helper.checkItemsAttributes([], { role: 'option' });
});

QUnit.test('Selected: ["Item_2"], change searchEnabled after initialize', () => {
QUnit.test('Selected: ["Item_2"], change searchEnabled after initialize', function() {
helper.createWidget({ selectedItemKeys: ['Item_2'], keyExpr: 'text', selectionMode: 'single' });
helper.widget.option('searchEnabled', !searchEnabled);

Expand All @@ -285,23 +285,23 @@ if(devices.real().deviceType === 'desktop') {
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option' });
});

QUnit.test('Selected: ["Item_2"], selectionMode: "single"', () => {
QUnit.test('Selected: ["Item_2"], selectionMode: "single"', function() {
helper.createWidget({ selectedItemKeys: ['Item_2'], keyExpr: 'text', selectionMode: 'single' });

helper.checkAttributes(searchEnabled ? helper.$itemContainer : helper.$widget, { role: 'listbox', tabindex: '0' });
helper.checkAttributes(searchEnabled ? helper.$widget : helper.$itemContainer, {});
helper.checkItemsAttributes([1], { attributes: ['aria-selected'], role: 'option' });
});

QUnit.test('Selected: ["Item_2", "Item_3"], selectionMode: "multiple"', () => {
QUnit.test('Selected: ["Item_2", "Item_3"], selectionMode: "multiple"', function() {
helper.createWidget({ selectedItemKeys: ['Item_2', 'Item_3'], keyExpr: 'text', selectionMode: 'multiple' });

helper.checkAttributes(searchEnabled ? helper.$itemContainer : helper.$widget, { role: 'listbox', tabindex: '0' });
helper.checkAttributes(searchEnabled ? helper.$widget : helper.$itemContainer, { });
helper.checkItemsAttributes([1, 2], { attributes: ['aria-selected'], role: 'option' });
});

QUnit.test('Selected: ["Item_1"] -> set focusedElement -> clean focusedElement', () => {
QUnit.test('Selected: ["Item_1"] -> set focusedElement -> clean focusedElement', function() {
helper.createWidget({ selectedItemKeys: ['Item_1'], keyExpr: 'text', selectionMode: 'single' });

helper.widget.option('focusedElement', helper.getItems().eq(0));
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/DevExpress.ui.widgets/menu.markup.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ QUnit.module('Aria accessibility', {
helper.$widget.remove();
}
}, () => {
QUnit.test('Items: []', () => {
QUnit.test('Items: []', function() {
helper.createWidget({ items: [] });
helper.checkAttributes(helper.$widget, { role: 'menubar', tabindex: '0' }, 'widget');
helper.checkItemsAttributes([], { role: 'menuitem', tabindex: '-1' });
});

QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement: items[0]', () => {
QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement: items[0]', function() {
helper.createWidget({
items: [{ text: 'Item1_1', items: [{ text: 'Item2_1' }, { text: 'Item2_2' }] }, { text: 'item1_2' }]
});
Expand Down
4 changes: 2 additions & 2 deletions testing/tests/DevExpress.ui.widgets/menuBase.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,13 +902,13 @@ QUnit.module('Aria accessibility', {
helper.$widget.remove();
}
}, () => {
QUnit.test('Items: [1]', () => {
QUnit.test('Items: [1]', function() {
helper.createWidget({ items: [1] });
helper.checkAttributes(helper.$widget, { tabindex: '0' }, 'widget');
helper.checkItemsAttributes([], { role: 'menuitem', tabindex: '-1' });
});

QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement: items[0]', () => {
QUnit.test('Items: [{items[{}, {}], {}] -> set focusedElement: items[0]', function() {
helper.createWidget({
items: [{ text: 'Item1_1', items: [{ text: 'Item2_1' }, { text: 'Item2_2' }] }, { text: 'item1_2' }]
});
Expand Down
Loading

0 comments on commit 6e0241f

Please sign in to comment.