Skip to content

Commit b839ba2

Browse files
authored
Editors and Overlays: get rid of toSelector outdated utility in tests (#30452)
1 parent 92f441b commit b839ba2

File tree

16 files changed

+524
-575
lines changed

16 files changed

+524
-575
lines changed

.github/CODEOWNERS

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -417,22 +417,22 @@
417417
/packages/devextreme/js/ui/multi_view.d.ts @DevExpress/devextreme-navigation @DevExpress/devextreme-apireviewers
418418

419419
## radio_group
420-
/packages/devextreme/js/ui/radio_group.js @DevExpress/devextreme-navigation
421-
/packages/devextreme/js/ui/radio_group/** @DevExpress/devextreme-navigation
422-
/packages/devextreme/js/__internal/ui/radio_group/** @DevExpress/devextreme-navigation
420+
/packages/devextreme/js/ui/radio_group.js @DevExpress/devextreme-editors
421+
/packages/devextreme/js/ui/radio_group/** @DevExpress/devextreme-editors
422+
/packages/devextreme/js/__internal/ui/radio_group/** @DevExpress/devextreme-editors
423423

424-
/packages/devextreme-scss/scss/**/radioGroup/** @DevExpress/devextreme-navigation
424+
/packages/devextreme-scss/scss/**/radioGroup/** @DevExpress/devextreme-editors
425425

426-
/apps/demos/Demos/RadioGroup/** @DevExpress/devextreme-navigation
426+
/apps/demos/Demos/RadioGroup/** @DevExpress/devextreme-editors
427427

428-
/packages/testcafe-models/radioGroup/** @DevExpress/devextreme-navigation
429-
/e2e/testcafe-devextreme/tests/accessibility/common/radioGroup.ts @DevExpress/devextreme-navigation
430-
/packages/devextreme/testing/tests/**/radioGroup.* @DevExpress/devextreme-navigation
431-
/packages/devextreme/testing/tests/**/radioButton.* @DevExpress/devextreme-navigation
428+
/packages/testcafe-models/radioGroup/** @DevExpress/devextreme-editors
429+
/e2e/testcafe-devextreme/tests/accessibility/common/radioGroup.ts @DevExpress/devextreme-editors
430+
/packages/devextreme/testing/tests/**/radioGroup.* @DevExpress/devextreme-editors
431+
/packages/devextreme/testing/tests/**/radioButton.* @DevExpress/devextreme-editors
432432

433-
/packages/devextreme/js/ui/radio_group_types.d.ts @DevExpress/devextreme-navigation @DevExpress/devextreme-apireviewers
434-
/packages/devextreme/js/ui/radio_group.d.ts @DevExpress/devextreme-navigation @DevExpress/devextreme-apireviewers
435-
/packages/devextreme/js/ui/radio_group/**/*.d.ts @DevExpress/devextreme-navigation @DevExpress/devextreme-apireviewers
433+
/packages/devextreme/js/ui/radio_group_types.d.ts @DevExpress/devextreme-editors @DevExpress/devextreme-apireviewers
434+
/packages/devextreme/js/ui/radio_group.d.ts @DevExpress/devextreme-editors @DevExpress/devextreme-apireviewers
435+
/packages/devextreme/js/ui/radio_group/**/*.d.ts @DevExpress/devextreme-editors @DevExpress/devextreme-apireviewers
436436

437437
## resizable
438438
/packages/devextreme/js/ui/resizable.js @DevExpress/devextreme-navigation

packages/devextreme/testing/tests/DevExpress.knockout/lookup.tests.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ QUnit.testStart(function() {
2323

2424
const LIST_CLASS = 'dx-list';
2525

26-
const toSelector = function(val) {
27-
return '.' + val;
28-
};
29-
3026
const openPopupWithList = function(lookup) {
3127
$(lookup._$field).trigger('dxclick');
3228
};
@@ -52,7 +48,7 @@ QUnit.test('lookup should delegate templates to child widgets (T131530)', functi
5248

5349
openPopupWithList(lookup);
5450

55-
const $list = $(toSelector(LIST_CLASS));
51+
const $list = $(`.${LIST_CLASS}`);
5652

5753
assert.equal($list.find('.dx-list-item').text().trim(), 'TemplateTemplate');
5854
});
@@ -65,7 +61,7 @@ QUnit.test('lookup with item template', function(assert) {
6561

6662
openPopupWithList(lookup);
6763

68-
const $list = $(toSelector(LIST_CLASS));
64+
const $list = $(`.${LIST_CLASS}`);
6965

7066
assert.equal($list.find('.dx-list-item').text().trim(), 'Template');
7167
});

packages/devextreme/testing/tests/DevExpress.serverSide/trackBar.tests.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ QUnit.testStart(function() {
1111
$('#qunit-fixture').html(markup);
1212
});
1313

14-
function toSelector(text) {
15-
return '.' + text;
16-
}
17-
1814
const TRACKBAR_RANGE_CLASS = 'dx-trackbar-range';
1915

2016
QUnit.module('Range width', {
@@ -28,7 +24,7 @@ QUnit.module('Range width', {
2824
min: 0,
2925
max: 100
3026
}).css('width', 100);
31-
const $range = $trackBar.find(toSelector(TRACKBAR_RANGE_CLASS));
27+
const $range = $trackBar.find(`.${TRACKBAR_RANGE_CLASS}`);
3228

3329
assert.equal($range[0].style.width, '0px', 'range width is right');
3430
});

packages/devextreme/testing/tests/DevExpress.ui.widgets.editors/calendar.markup.tests.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ const CALENDAR_RANGE_CLASS = 'dx-calendar-range';
2222

2323
const ARIA_LABEL_DATE_FORMAT = 'date';
2424

25-
const toSelector = function(className) {
26-
return '.' + className;
27-
};
28-
2925
const getFormattedDate = (date) => {
3026
return dateLocalization.format(new Date(date), ARIA_LABEL_DATE_FORMAT);
3127
};
@@ -50,17 +46,17 @@ QUnit.module('Calendar markup', {
5046
});
5147

5248
QUnit.test('navigator is rendered', function(assert) {
53-
assert.equal(this.$element.find(toSelector(CALENDAR_NAVIGATOR_CLASS)).length, 1, 'navigator is rendered');
49+
assert.equal(this.$element.find(`.${CALENDAR_NAVIGATOR_CLASS}`).length, 1, 'navigator is rendered');
5450
});
5551

5652
[1, 2].forEach((viewsCount) => {
5753
QUnit.test(`rendered views amount is correct when viewsCount option equals ${viewsCount}`, function(assert) {
5854
this.calendar.option('viewsCount', viewsCount);
5955
if(windowUtils.hasWindow()) {
6056
const hiddenViews = 2;
61-
assert.equal(this.$element.find(toSelector(CALENDAR_VIEWS_WRAPPER_CLASS) + ' .dx-widget').length, viewsCount + hiddenViews, 'all views are rendered');
57+
assert.equal(this.$element.find(`.${CALENDAR_VIEWS_WRAPPER_CLASS} .dx-widget`).length, viewsCount + hiddenViews, 'all views are rendered');
6258
} else {
63-
assert.equal(this.$element.find(toSelector(CALENDAR_VIEWS_WRAPPER_CLASS) + ' .dx-widget').length, viewsCount, 'only one view is rendered');
59+
assert.equal(this.$element.find(`.${CALENDAR_VIEWS_WRAPPER_CLASS} .dx-widget`).length, viewsCount, 'only one view is rendered');
6460
}
6561
});
6662
});
@@ -164,18 +160,18 @@ QUnit.module('Navigator', {
164160
});
165161

166162
QUnit.test('Calendar must display previous and next month links, and previous and next year links', function(assert) {
167-
assert.strictEqual(this.$element.find(toSelector(CALENDAR_NAVIGATOR_PREVIOUS_VIEW_CLASS)).length, 1);
168-
assert.strictEqual(this.$element.find(toSelector(CALENDAR_NAVIGATOR_NEXT_VIEW_CLASS)).length, 1);
163+
assert.strictEqual(this.$element.find(`.${CALENDAR_NAVIGATOR_PREVIOUS_VIEW_CLASS}`).length, 1);
164+
assert.strictEqual(this.$element.find(`.${CALENDAR_NAVIGATOR_NEXT_VIEW_CLASS}`).length, 1);
169165
});
170166

171167
QUnit.test('Calendar must display the current month and year', function(assert) {
172-
const navigatorCaption = this.$element.find(toSelector(CALENDAR_CAPTION_BUTTON_CLASS));
168+
const navigatorCaption = this.$element.find(`.${CALENDAR_CAPTION_BUTTON_CLASS}`);
173169
assert.equal(navigatorCaption.text(), 'June 2015');
174170
});
175171

176172
QUnit.test('Calendar with two views should display 2 months', function(assert) {
177173
this.calendar.option('viewsCount', 2);
178-
const navigatorCaption = this.$element.find(toSelector(CALENDAR_CAPTION_BUTTON_CLASS));
174+
const navigatorCaption = this.$element.find(`.${CALENDAR_CAPTION_BUTTON_CLASS}`);
179175
assert.equal(navigatorCaption.text(), 'June 2015July 2015');
180176
});
181177
});
@@ -194,7 +190,7 @@ QUnit.module('Calendar footer', {
194190
value: new Date(2015, 5, 13),
195191
showTodayButton: true
196192
}).dxCalendar('instance');
197-
assert.equal($element.find(toSelector(CALENDAR_FOOTER_CLASS)).length, 1, 'footer exist');
193+
assert.equal($element.find(`.${CALENDAR_FOOTER_CLASS}`).length, 1, 'footer exist');
198194
});
199195

200196
QUnit.test('calendar mustn\'t have _footer if showTodayButton = false', function(assert) {
@@ -203,7 +199,7 @@ QUnit.module('Calendar footer', {
203199
value: new Date(2015, 5, 13),
204200
showTodayButton: false
205201
}).dxCalendar('instance');
206-
assert.equal($element.find(toSelector(CALENDAR_FOOTER_CLASS)).length, 0, 'footer doesn\'t exist');
202+
assert.equal($element.find(`.${CALENDAR_FOOTER_CLASS}`).length, 0, 'footer doesn\'t exist');
207203
});
208204
});
209205

0 commit comments

Comments
 (0)