Skip to content

Commit 5458c7e

Browse files
Scheduler - Update QUnit tests to use getCellData instead of dxCellData
1 parent 62c1362 commit 5458c7e

8 files changed

Lines changed: 798 additions & 916 deletions

File tree

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.week.based.views.tests.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,7 @@ module('Integration: Appointment Day, Week views', {
145145

146146
const cell = scheduler.workSpace.getCell(2, 0).get(0);
147147

148-
const relatedCellData = !scheduler.instance.option('renovateRender')
149-
? dataUtils.data(cell, 'dxCellData').startDate
150-
: scheduler.instance.getWorkSpace().getCellData($(cell)).startDate;
148+
const relatedCellData = scheduler.instance.getWorkSpace().getCellData($(cell)).startDate;
151149

152150
assert.equal(relatedCellData.getTime(), new Date(2015, 1, 9, 1).getTime(), 'Cell start date is OK');
153151
} finally {

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/integration.workSpace.tests.js

Lines changed: 224 additions & 234 deletions
Large diffs are not rendered by default.

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

Lines changed: 173 additions & 206 deletions
Large diffs are not rendered by default.

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

Lines changed: 49 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -91,63 +91,59 @@ QUnit.test('Date table should have a correct width if cell is less than 75px', a
9191
assert.equal(dateTableWidth, 1440, 'Width is OK');
9292
});
9393

94-
[true, false].forEach((renovateRender) => {
95-
QUnit.test(`Sidebar scrollable should update position if date scrollable position is changed when renovateRender is ${renovateRender}`, async function(assert) {
96-
const done = assert.async();
94+
QUnit.test('Sidebar scrollable should update position if date scrollable position is changed', async function(assert) {
95+
const done = assert.async();
9796

98-
const resourceConfig = await getWorkspaceResourceConfig([{
99-
label: 'one',
100-
fieldExpr: 'one',
101-
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }, { id: 3, text: 'c' }, { id: 4, text: 'd' }]
102-
}]);
103-
this.instance.option({
104-
crossScrollingEnabled: true,
105-
width: 400,
106-
height: 150,
107-
...resourceConfig,
108-
renovateRender,
109-
});
97+
const resourceConfig = await getWorkspaceResourceConfig([{
98+
label: 'one',
99+
fieldExpr: 'one',
100+
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }, { id: 3, text: 'c' }, { id: 4, text: 'd' }]
101+
}]);
102+
this.instance.option({
103+
crossScrollingEnabled: true,
104+
width: 400,
105+
height: 150,
106+
...resourceConfig,
107+
});
110108

111-
const $element = this.instance.$element();
112-
const groupPanelScrollable = $element.find('.dx-scheduler-sidebar-scrollable').dxScrollable('instance');
113-
const dateTableScrollable = $element.find('.dx-scheduler-date-table-scrollable').dxScrollable('instance');
109+
const $element = this.instance.$element();
110+
const groupPanelScrollable = $element.find('.dx-scheduler-sidebar-scrollable').dxScrollable('instance');
111+
const dateTableScrollable = $element.find('.dx-scheduler-date-table-scrollable').dxScrollable('instance');
114112

115-
triggerHidingEvent($element);
116-
triggerShownEvent($element);
113+
triggerHidingEvent($element);
114+
triggerShownEvent($element);
117115

118-
dateTableScrollable.scrollTo({ top: 102 });
116+
dateTableScrollable.scrollTo({ top: 102 });
119117

120-
setTimeout(() => {
121-
assert.equal(groupPanelScrollable.scrollTop(), 87, 'Scroll position is OK');
122-
done();
123-
}, 100);
124-
});
118+
setTimeout(() => {
119+
assert.equal(groupPanelScrollable.scrollTop(), 87, 'Scroll position is OK');
120+
done();
121+
}, 100);
122+
});
125123

126-
QUnit.test(`Date table scrollable should update position if sidebar position is changed when renovateRender is ${renovateRender}`, async function(assert) {
127-
const resourceConfig = await getWorkspaceResourceConfig([{
128-
label: 'one',
129-
fieldExpr: 'one',
130-
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }, { id: 3, text: 'c' }, { id: 4, text: 'd' }]
131-
}]);
132-
this.instance.option({
133-
crossScrollingEnabled: true,
134-
width: 400,
135-
height: 150,
136-
...resourceConfig,
137-
renovateRender,
138-
});
124+
QUnit.test('Date table scrollable should update position if sidebar position is changed', async function(assert) {
125+
const resourceConfig = await getWorkspaceResourceConfig([{
126+
label: 'one',
127+
fieldExpr: 'one',
128+
dataSource: [{ id: 1, text: 'a' }, { id: 2, text: 'b' }, { id: 3, text: 'c' }, { id: 4, text: 'd' }]
129+
}]);
130+
this.instance.option({
131+
crossScrollingEnabled: true,
132+
width: 400,
133+
height: 150,
134+
...resourceConfig,
135+
});
139136

140-
const $element = this.instance.$element();
141-
const groupPanelScrollable = $element.find('.dx-scheduler-sidebar-scrollable').dxScrollable('instance');
142-
const dateTableScrollable = $element.find('.dx-scheduler-date-table-scrollable').dxScrollable('instance');
137+
const $element = this.instance.$element();
138+
const groupPanelScrollable = $element.find('.dx-scheduler-sidebar-scrollable').dxScrollable('instance');
139+
const dateTableScrollable = $element.find('.dx-scheduler-date-table-scrollable').dxScrollable('instance');
143140

144-
triggerHidingEvent($element);
145-
triggerShownEvent($element);
141+
triggerHidingEvent($element);
142+
triggerShownEvent($element);
146143

147-
groupPanelScrollable.scrollTo({ top: 102 });
144+
groupPanelScrollable.scrollTo({ top: 102 });
148145

149-
assert.equal(dateTableScrollable.scrollTop(), 87, 'Scroll position is OK');
150-
});
146+
assert.equal(dateTableScrollable.scrollTop(), 87, 'Scroll position is OK');
151147
});
152148

153149
QUnit.test('Date table scrollable should update position if header scrollable position is changed', async function(assert) {
@@ -460,7 +456,6 @@ QUnit.module('Timeline Keyboard Navigation', () => {
460456
e.component.initDragBehavior();
461457
e.component.attachTablesEvents();
462458
},
463-
renovateRender: true,
464459
scrolling: { mode: scrollingMode, orientation: 'vertical' },
465460
getResourceManager: getEmptyResourceManager,
466461
}).dxSchedulerTimelineMonth('instance');
@@ -615,7 +610,6 @@ QUnit.module('Timeline Keyboard Navigation', () => {
615610
...resourceConfig,
616611
allowMultipleCellSelection: true,
617612
scrolling: { mode: scrollingMode, orientation: 'vertical' },
618-
renovateRender: true,
619613
});
620614

621615
const $element = this.instance.$element();
@@ -735,11 +729,9 @@ QUnit.test('Group header should be rendered correct, groupByDate = true and cros
735729
});
736730

737731
QUnit.test('Date table cells shoud have right cellData, groupByDate = true', async function(assert) {
738-
this.instance.option('renovateRender', false);
739-
740732
const $cells = this.instance.$element().find('.dx-scheduler-date-table-cell');
741733

742-
assert.deepEqual($cells.eq(0).data('dxCellData'), {
734+
assert.deepEqual(this.instance.getCellData($cells.eq(0)), {
743735
startDate: new Date(2018, 1, 25, 9, 0),
744736
endDate: new Date(2018, 1, 25, 9, 30),
745737
allDay: false,
@@ -749,7 +741,7 @@ QUnit.test('Date table cells shoud have right cellData, groupByDate = true', asy
749741
groupIndex: 0,
750742
});
751743

752-
assert.deepEqual($cells.eq(1).data('dxCellData'), {
744+
assert.deepEqual(this.instance.getCellData($cells.eq(1)), {
753745
startDate: new Date(2018, 1, 25, 9, 0),
754746
endDate: new Date(2018, 1, 25, 9, 30),
755747
allDay: false,
@@ -759,7 +751,7 @@ QUnit.test('Date table cells shoud have right cellData, groupByDate = true', asy
759751
groupIndex: 1,
760752
});
761753

762-
assert.deepEqual($cells.eq(50).data('dxCellData'), {
754+
assert.deepEqual(this.instance.getCellData($cells.eq(50)), {
763755
startDate: new Date(2018, 2, 1, 9, 30),
764756
endDate: new Date(2018, 2, 1, 10),
765757
allDay: false,
@@ -769,7 +761,7 @@ QUnit.test('Date table cells shoud have right cellData, groupByDate = true', asy
769761
groupIndex: 0,
770762
});
771763

772-
assert.deepEqual($cells.eq(51).data('dxCellData'), {
764+
assert.deepEqual(this.instance.getCellData($cells.eq(51)), {
773765
startDate: new Date(2018, 2, 1, 9, 30),
774766
endDate: new Date(2018, 2, 1, 10),
775767
allDay: false,
@@ -779,7 +771,7 @@ QUnit.test('Date table cells shoud have right cellData, groupByDate = true', asy
779771
groupIndex: 1,
780772
});
781773

782-
assert.deepEqual($cells.eq(82).data('dxCellData'), {
774+
assert.deepEqual(this.instance.getCellData($cells.eq(82)), {
783775
startDate: new Date(2018, 2, 3, 11, 30),
784776
endDate: new Date(2018, 2, 3, 12),
785777
allDay: false,
@@ -789,7 +781,7 @@ QUnit.test('Date table cells shoud have right cellData, groupByDate = true', asy
789781
groupIndex: 0,
790782
});
791783

792-
assert.deepEqual($cells.eq(83).data('dxCellData'), {
784+
assert.deepEqual(this.instance.getCellData($cells.eq(83)), {
793785
startDate: new Date(2018, 2, 3, 11, 30),
794786
endDate: new Date(2018, 2, 3, 12),
795787
allDay: false,
@@ -876,7 +868,6 @@ QUnit.module('Renovated Render', {
876868
beforeEach() {
877869
this.createInstance = (options = {}, workSpace = 'dxSchedulerTimelineDay') => {
878870
this.instance = $('#scheduler-timeline')[workSpace]({
879-
renovateRender: true,
880871
currentDate: new Date(2020, 11, 21),
881872
startDayHour: 0,
882873
endDayHour: 1,

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/workSpace.day.tests.js

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,11 @@ module('Work Space Day', {
195195
});
196196

197197
test('Each cell should contain jQuery dxCellData', async function(assert) {
198-
this.instance.option('renovateRender', false);
199-
200198
this.instance.option('currentDate', new Date(2015, 2, 16));
201199

202200
const $cell = this.instance.$element().find('.' + CELL_CLASS).first();
203201

204-
assert.deepEqual($cell.data('dxCellData'), {
202+
assert.deepEqual(this.instance.getCellData($cell), {
205203
startDate: new Date(2015, 2, 16, 0, 0),
206204
endDate: new Date(2015, 2, 16, 0, 30),
207205
allDay: false,
@@ -210,19 +208,15 @@ module('Work Space Day', {
210208
});
211209

212210
test('dxCellData should be \'immutable\'', function(assert) {
213-
this.instance.option('renovateRender', false);
214-
215211
const $element = this.instance.$element();
216212
const $cell = $element.find('.' + CELL_CLASS).first();
217213
const cellData = this.instance.getCellData($cell);
218214

219215
cellData.cellCustomField = 'cell-custom-data';
220-
assert.strictEqual($element.find('.' + CELL_CLASS).first().data('dxCellData').cellCustomField, undefined, 'Cell data is not affected');
216+
assert.strictEqual(this.instance.getCellData($element.find('.' + CELL_CLASS).first()).cellCustomField, undefined, 'Cell data is not affected');
221217
});
222218

223219
test('Cells have right cellData in vertical grouped WorkSpace Day view', async function(assert) {
224-
this.instance.option('renovateRender', false);
225-
226220
await applyWorkspaceGroups(this.instance, [{
227221
label: 'one',
228222
fieldExpr: 'one',
@@ -234,8 +228,8 @@ module('Work Space Day', {
234228
startDayHour: 9,
235229
showAllDayPanel: false
236230
});
237-
const firstCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0).data('dxCellData');
238-
const secondCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(36).data('dxCellData');
231+
const firstCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0));
232+
const secondCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(36));
239233

240234
assert.deepEqual(firstCellData.startDate, new Date(2018, 2, 16, 9), 'cell has right startDate');
241235
assert.deepEqual(firstCellData.endDate, new Date(2018, 2, 16, 9, 30), 'cell has right endDate');
@@ -284,12 +278,10 @@ module('Work Space Day with grouping by date', () => {
284278
});
285279

286280
test('Date table cells shoud have right cellData, groupByDate = true', async function(assert) {
287-
this.instance.option('renovateRender', false);
288-
289281
this.instance.option('intervalCount', 3);
290282
const $cells = this.instance.$element().find('.dx-scheduler-date-table-cell');
291283

292-
assert.deepEqual($cells.eq(0).data('dxCellData'), {
284+
assert.deepEqual(this.instance.getCellData($cells.eq(0)), {
293285
startDate: new Date(2018, 2, 1),
294286
endDate: new Date(2018, 2, 1, 0, 30),
295287
allDay: false,
@@ -299,7 +291,7 @@ module('Work Space Day with grouping by date', () => {
299291
groupIndex: 0,
300292
});
301293

302-
assert.deepEqual($cells.eq(1).data('dxCellData'), {
294+
assert.deepEqual(this.instance.getCellData($cells.eq(1)), {
303295
startDate: new Date(2018, 2, 1),
304296
endDate: new Date(2018, 2, 1, 0, 30),
305297
allDay: false,
@@ -309,7 +301,7 @@ module('Work Space Day with grouping by date', () => {
309301
groupIndex: 1,
310302
});
311303

312-
assert.deepEqual($cells.eq(2).data('dxCellData'), {
304+
assert.deepEqual(this.instance.getCellData($cells.eq(2)), {
313305
startDate: new Date(2018, 2, 2),
314306
endDate: new Date(2018, 2, 2, 0, 30),
315307
allDay: false,
@@ -319,7 +311,7 @@ module('Work Space Day with grouping by date', () => {
319311
groupIndex: 0,
320312
});
321313

322-
assert.deepEqual($cells.eq(3).data('dxCellData'), {
314+
assert.deepEqual(this.instance.getCellData($cells.eq(3)), {
323315
startDate: new Date(2018, 2, 2),
324316
endDate: new Date(2018, 2, 2, 0, 30),
325317
allDay: false,
@@ -329,7 +321,7 @@ module('Work Space Day with grouping by date', () => {
329321
groupIndex: 1,
330322
});
331323

332-
assert.deepEqual($cells.eq(4).data('dxCellData'), {
324+
assert.deepEqual(this.instance.getCellData($cells.eq(4)), {
333325
startDate: new Date(2018, 2, 3),
334326
endDate: new Date(2018, 2, 3, 0, 30),
335327
allDay: false,
@@ -339,7 +331,7 @@ module('Work Space Day with grouping by date', () => {
339331
groupIndex: 0,
340332
});
341333

342-
assert.deepEqual($cells.eq(5).data('dxCellData'), {
334+
assert.deepEqual(this.instance.getCellData($cells.eq(5)), {
343335
startDate: new Date(2018, 2, 3),
344336
endDate: new Date(2018, 2, 3, 0, 30),
345337
allDay: false,
@@ -351,34 +343,32 @@ module('Work Space Day with grouping by date', () => {
351343
});
352344

353345
test('Date table cells should have right cellData, groupByDate = true without groups', async function(assert) {
354-
this.instance.option('renovateRender', false);
355-
356346
this.instance.option('getResourceManager', getEmptyResourceManager);
357347
this.instance.option('groups', []);
358348
const $cells = this.instance.$element().find('.dx-scheduler-date-table-cell');
359349

360-
assert.deepEqual($cells.eq(0).data('dxCellData'), {
350+
assert.deepEqual(this.instance.getCellData($cells.eq(0)), {
361351
startDate: new Date(2018, 2, 1),
362352
endDate: new Date(2018, 2, 1, 0, 30),
363353
allDay: false,
364354
groupIndex: 0,
365355
});
366356

367-
assert.deepEqual($cells.eq(1).data('dxCellData'), {
357+
assert.deepEqual(this.instance.getCellData($cells.eq(1)), {
368358
startDate: new Date(2018, 2, 2),
369359
endDate: new Date(2018, 2, 2, 0, 30),
370360
allDay: false,
371361
groupIndex: 0,
372362
});
373363

374-
assert.deepEqual($cells.eq(2).data('dxCellData'), {
364+
assert.deepEqual(this.instance.getCellData($cells.eq(2)), {
375365
startDate: new Date(2018, 2, 1, 0, 30),
376366
endDate: new Date(2018, 2, 1, 1, 0),
377367
allDay: false,
378368
groupIndex: 0,
379369
});
380370

381-
assert.deepEqual($cells.eq(3).data('dxCellData'), {
371+
assert.deepEqual(this.instance.getCellData($cells.eq(3)), {
382372
startDate: new Date(2018, 2, 2, 0, 30),
383373
endDate: new Date(2018, 2, 2, 1, 0),
384374
allDay: false,
@@ -443,11 +433,10 @@ module('Work Space Day with grouping by date', () => {
443433
this.createInstance({
444434
intervalCount: 2,
445435
currentDate: new Date(2017, 5, 29),
446-
renovateRender: false,
447436
});
448437

449-
const firstCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(1).data('dxCellData');
450-
const secondCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(95).data('dxCellData');
438+
const firstCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(1));
439+
const secondCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(95));
451440

452441
assert.deepEqual(firstCellData.startDate, new Date(2017, 5, 30, 0), 'cell has right startDate');
453442
assert.deepEqual(firstCellData.endDate, new Date(2017, 5, 30, 0, 30), 'cell has right endtDate');
@@ -461,11 +450,10 @@ module('Work Space Day with grouping by date', () => {
461450
intervalCount: 3,
462451
currentDate: new Date(2017, 5, 28),
463452
startDate: new Date(2017, 5, 21),
464-
renovateRender: false,
465453
});
466454

467-
const firstCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0).data('dxCellData');
468-
const secondCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(143).data('dxCellData');
455+
const firstCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0));
456+
const secondCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(143));
469457

470458
assert.deepEqual(firstCellData.startDate, new Date(2017, 5, 27, 0), 'cell has right startDate');
471459
assert.deepEqual(firstCellData.endDate, new Date(2017, 5, 27, 0, 30), 'cell has right endtDate');
@@ -479,11 +467,10 @@ module('Work Space Day with grouping by date', () => {
479467
intervalCount: 3,
480468
currentDate: new Date(2017, 5, 25),
481469
startDate: new Date(2017, 5, 30),
482-
renovateRender: false,
483470
});
484471

485-
const firstCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0).data('dxCellData');
486-
const secondCellData = this.instance.$element().find('.dx-scheduler-date-table-cell').eq(143).data('dxCellData');
472+
const firstCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(0));
473+
const secondCellData = this.instance.getCellData(this.instance.$element().find('.dx-scheduler-date-table-cell').eq(143));
487474

488475
assert.deepEqual(firstCellData.startDate, new Date(2017, 5, 24, 0), 'cell has right startDate');
489476
assert.deepEqual(firstCellData.endDate, new Date(2017, 5, 24, 0, 30), 'cell has right endtDate');

0 commit comments

Comments
 (0)