Skip to content

Commit 6c07aca

Browse files
authored
Scheduler: get rid of outdated toSelector utility in tests (#30457)
1 parent ebd69ad commit 6c07aca

File tree

3 files changed

+51
-57
lines changed

3 files changed

+51
-57
lines changed

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/timeline.markup.tests.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ const TIMELINE_DAY = { class: 'dxSchedulerTimelineDay', name: 'SchedulerTimeline
3434
const TIMELINE_WEEK = { class: 'dxSchedulerTimelineWeek', name: 'SchedulerTimelineWeek' };
3535
const TIMELINE_MONTH = { class: 'dxSchedulerTimelineMonth', name: 'SchedulerTimelineMonth' };
3636

37-
const toSelector = cssClass => '.' + cssClass;
38-
3937
const checkHeaderCells = function($element, assert, interval, groupCount, viewDuration) {
4038
interval = interval || 0.5;
4139
viewDuration = viewDuration || 1;
@@ -1223,7 +1221,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
12231221
QUnit.test(`first-group-cell class should be assigned to correct cells in basic case in ${view.name}`, async function(assert) {
12241222
const instance = await this.createInstance(view.class);
12251223

1226-
instance.$element().find(toSelector(CELL_CLASS)).each(function() {
1224+
instance.$element().find(`.${CELL_CLASS}`).each(function() {
12271225
assert.ok($(this).hasClass(FIRST_GROUP_CELL_CLASS), 'Date table cell has first-group class');
12281226
});
12291227

@@ -1241,7 +1239,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
12411239
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
12421240
}]);
12431241

1244-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1242+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
12451243
checkFirstGroupCell(assert, this, index, columnCountInGroup, 'Date table');
12461244
});
12471245

@@ -1261,7 +1259,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
12611259
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
12621260
}]);
12631261

1264-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1262+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
12651263
checkFirstGroupCell(assert, this, index, GROUP_COUNT, 'Date table');
12661264
});
12671265

@@ -1281,7 +1279,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
12811279
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
12821280
}]);
12831281

1284-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1282+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
12851283
if(Math.floor(index / columnCountInGroup) % rowCountInGroup === 0) {
12861284
assert.ok($(this).hasClass(FIRST_GROUP_CELL_CLASS), 'Date table cell has first-group class');
12871285
} else {
@@ -1297,7 +1295,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
12971295
QUnit.test(`last-group-cell class should be assigned to correct cells in basic case in ${view.name}`, async function(assert) {
12981296
const instance = await this.createInstance(view.class);
12991297

1300-
instance.$element().find(toSelector(CELL_CLASS)).each(function() {
1298+
instance.$element().find(`.${CELL_CLASS}`).each(function() {
13011299
assert.ok($(this).hasClass(LAST_GROUP_CELL_CLASS), 'Date table cell has last-group class');
13021300
});
13031301

@@ -1315,7 +1313,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
13151313
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
13161314
}]);
13171315

1318-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1316+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
13191317
checkLastGroupCell(assert, this, index, columnCountInGroup, 'Date table');
13201318
});
13211319

@@ -1335,7 +1333,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
13351333
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
13361334
}]);
13371335

1338-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1336+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
13391337
checkLastGroupCell(assert, this, index, GROUP_COUNT, 'Date table');
13401338
});
13411339

@@ -1355,7 +1353,7 @@ QUnit.module('FirstGroupCell and LastGroupCell classes', () => {
13551353
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }]
13561354
}]);
13571355

1358-
instance.$element().find(toSelector(CELL_CLASS)).each(function(index) {
1356+
instance.$element().find(`.${CELL_CLASS}`).each(function(index) {
13591357
if((Math.floor(index / columnCountInGroup) + 1) % rowCountInGroup === 0) {
13601358
assert.ok($(this).hasClass(LAST_GROUP_CELL_CLASS), 'Date table cell has last-group class');
13611359
} else {

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.markup-0.tests.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ const ALL_DAY_TITLE_CLASS = 'dx-scheduler-all-day-title';
2626

2727
const VERTICAL_SIZES_CLASS = 'dx-scheduler-cell-sizes-vertical';
2828

29-
const toSelector = cssClass => '.' + cssClass;
30-
3129
[{
3230
viewName: 'Day',
3331
view: 'dxSchedulerWorkSpaceDay',
@@ -65,9 +63,9 @@ const toSelector = cssClass => '.' + cssClass;
6563
if(viewName === 'Day' || viewName === 'Week') {
6664
QUnit.test('All day title should be rendered in header panel empty cell', async function(assert) {
6765
const $element = this.instance.$element();
68-
const headerEmptyCell = $element.find(toSelector('dx-scheduler-header-panel-empty-cell'));
66+
const headerEmptyCell = $element.find('.dx-scheduler-header-panel-empty-cell');
6967

70-
assert.equal(headerEmptyCell.children(toSelector(ALL_DAY_TITLE_CLASS)).length, 1, 'All-day-title is OK');
68+
assert.equal(headerEmptyCell.children(`.${ALL_DAY_TITLE_CLASS}`).length, 1, 'All-day-title is OK');
7169
});
7270

7371
QUnit.test('Workspace should have specific css class, if showAllDayPanel = true ', async function(assert) {
@@ -109,10 +107,10 @@ const toSelector = cssClass => '.' + cssClass;
109107
QUnit.test('Scheduler workspace should contain time panel, header panel, allday panel and content', async function(assert) {
110108
const $element = this.instance.$element();
111109

112-
assert.equal($element.find(toSelector(HEADER_PANEL_CLASS)).length, 1, 'Workspace contains the time panel');
113-
assert.equal($element.find(toSelector(ALL_DAY_PANEL_CLASS)).length, 1, 'Workspace contains the all day panel');
114-
assert.equal($element.find(toSelector(TIME_PANEL_CLASS)).length, 1, 'Workspace contains the time panel');
115-
assert.equal($element.find(toSelector(DATE_TABLE_CLASS)).length, 1, 'Workspace contains date table');
110+
assert.equal($element.find(`.${HEADER_PANEL_CLASS}`).length, 1, 'Workspace contains the time panel');
111+
assert.equal($element.find(`.${ALL_DAY_PANEL_CLASS}`).length, 1, 'Workspace contains the all day panel');
112+
assert.equal($element.find(`.${TIME_PANEL_CLASS}`).length, 1, 'Workspace contains the time panel');
113+
assert.equal($element.find(`.${DATE_TABLE_CLASS}`).length, 1, 'Workspace contains date table');
116114
});
117115

118116
QUnit.test('Time panel cells and rows should have special css classes', async function(assert) {

0 commit comments

Comments
 (0)