Skip to content

Commit c6b9752

Browse files
Scheduler - Clean up remaining renovateRender references, rename test descriptions, remove redundant setCurrentTimeCells
1 parent 5458c7e commit c6b9752

17 files changed

Lines changed: 442 additions & 502 deletions

packages/devextreme/js/__internal/scheduler/workspaces/m_work_space_indicator.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import SchedulerWorkSpace from './m_work_space';
1515
const toMs = dateUtils.dateToMilliseconds;
1616

1717
const SCHEDULER_DATE_TIME_INDICATOR_CLASS = 'dx-scheduler-date-time-indicator';
18-
const TIME_PANEL_CURRENT_TIME_CELL_CLASS = 'dx-scheduler-time-panel-current-time-cell';
1918

2019
class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace {
2120
private indicatorInterval: any;
@@ -301,17 +300,6 @@ class SchedulerWorkSpaceIndicator extends SchedulerWorkSpace {
301300
const rtlOffset = this.getRtlOffset(this.getCellWidth());
302301

303302
this.renderIndicator(height, rtlOffset, $container, groupCount);
304-
305-
this.setCurrentTimeCells();
306-
}
307-
308-
protected setCurrentTimeCells(): void {
309-
const timePanelCells = this.getTimePanelCells();
310-
const currentTimeCellIndices = this.getCurrentTimePanelCellIndices();
311-
currentTimeCellIndices.forEach((timePanelCellIndex) => {
312-
timePanelCells.eq(timePanelCellIndex)
313-
.addClass(TIME_PANEL_CURRENT_TIME_CELL_CLASS);
314-
});
315303
}
316304
}
317305

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.timeLines.tests.js

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -554,44 +554,41 @@ module('Integration: Appointments in Timeline views', {
554554
}
555555
});
556556

557-
[true, false].forEach((isRenovatedRender) => {
558-
test(`Multi-day appointment should be rendered when started after endDayHour (T819852) when renovateRender is ${isRenovatedRender}`, async function(assert) {
559-
const data = [{
560-
text: 'Default appt',
561-
startDate: new Date('2019-10-03T06:00:00.000'),
562-
endDate: new Date('2019-10-03T18:00:00.000'),
563-
}, {
564-
text: 'Appt with end before endDayHour',
565-
startDate: new Date('2019-10-02T17:00:00.000'),
566-
endDate: new Date('2019-10-03T17:00:00.000'),
567-
}, {
568-
text: 'Appt with end before startDayHour',
569-
startDate: new Date('2019-10-02T17:30:00.000'),
570-
endDate: new Date('2019-10-02T18:30:00.000'),
571-
}, {
572-
text: 'Appt with end after endDayHour',
573-
startDate: new Date('2019-10-02T18:55:00.000'),
574-
endDate: new Date('2019-10-03T19:00:00.000'),
575-
}];
576-
577-
const scheduler = await createInstance({
578-
dataSource: data,
579-
views: ['timelineWeek'],
580-
currentView: 'timelineWeek',
581-
currentDate: new Date(2019, 9, 4),
582-
cellDuration: 660,
583-
startDayHour: 7,
584-
endDayHour: 18,
585-
height: 580,
586-
renovateRender: scrollingMode === 'virtual' || isRenovatedRender,
587-
width: 800
588-
});
557+
test('Multi-day appointment should be rendered when started after endDayHour (T819852)', async function(assert) {
558+
const data = [{
559+
text: 'Default appt',
560+
startDate: new Date('2019-10-03T06:00:00.000'),
561+
endDate: new Date('2019-10-03T18:00:00.000'),
562+
}, {
563+
text: 'Appt with end before endDayHour',
564+
startDate: new Date('2019-10-02T17:00:00.000'),
565+
endDate: new Date('2019-10-03T17:00:00.000'),
566+
}, {
567+
text: 'Appt with end before startDayHour',
568+
startDate: new Date('2019-10-02T17:30:00.000'),
569+
endDate: new Date('2019-10-02T18:30:00.000'),
570+
}, {
571+
text: 'Appt with end after endDayHour',
572+
startDate: new Date('2019-10-02T18:55:00.000'),
573+
endDate: new Date('2019-10-03T19:00:00.000'),
574+
}];
589575

590-
assert.strictEqual(scheduler.appointments.getAppointmentCount(), 4, 'Appointments are rendered');
591-
assert.strictEqual($(scheduler.appointments.getAppointment(2)).position().left, $(scheduler.appointments.getAppointment(3)).position().left, 'Appointments have same left coordinate');
592-
assert.strictEqual($(scheduler.appointments.getAppointment(2)).innerWidth(), $(scheduler.appointments.getAppointment(3)).innerWidth(), 'Appointments with equal coords have same width');
593-
assert.strictEqual($(scheduler.appointments.getAppointment(3)).innerWidth(), $(scheduler.appointments.getAppointment(3)).innerWidth(), 'Appointments with defferent coords have same width');
576+
const scheduler = await createInstance({
577+
dataSource: data,
578+
views: ['timelineWeek'],
579+
currentView: 'timelineWeek',
580+
currentDate: new Date(2019, 9, 4),
581+
cellDuration: 660,
582+
startDayHour: 7,
583+
endDayHour: 18,
584+
height: 580,
585+
width: 800
594586
});
587+
588+
assert.strictEqual(scheduler.appointments.getAppointmentCount(), 4, 'Appointments are rendered');
589+
assert.strictEqual($(scheduler.appointments.getAppointment(2)).position().left, $(scheduler.appointments.getAppointment(3)).position().left, 'Appointments have same left coordinate');
590+
assert.strictEqual($(scheduler.appointments.getAppointment(2)).innerWidth(), $(scheduler.appointments.getAppointment(3)).innerWidth(), 'Appointments with equal coords have same width');
591+
assert.strictEqual($(scheduler.appointments.getAppointment(3)).innerWidth(), $(scheduler.appointments.getAppointment(3)).innerWidth(), 'Appointments with defferent coords have same width');
595592
});
596593
});
597594
});

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

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -764,32 +764,29 @@ QUnit.module('View with configuration', () => {
764764
assert.roughEqual(scrollable.scrollHeight(), dateTableHeight, 1.01, 'Scroll height > minWorspaceHeight');
765765
});
766766

767-
[true, false].forEach((renovateRender) => {
768-
QUnit.test(`Workspace vertical scroll should be equal to the dataTable height if grouping, view: '${viewName}', view.intervalCount=${intervalCount}, height: ${height}, renovateRender: ${renovateRender}`, async function(assert) {
769-
const scheduler = await createWrapper({
770-
height: height,
771-
views: [{
772-
type: viewName,
773-
name: viewName,
774-
intervalCount: intervalCount
775-
}],
776-
currentView: viewName,
777-
groups: ['any'],
778-
resources: [{
779-
fieldExpr: 'any',
780-
dataSource: [
781-
{ text: 'Group_1', id: 1 },
782-
{ text: 'Group_2', id: 2 },
783-
{ text: 'Group_3', id: 3 }
784-
],
785-
}],
786-
renovateRender,
787-
});
788-
789-
const dateTableHeight = scheduler.workSpace.getDateTableHeight();
790-
const scrollable = scheduler.workSpace.getScrollable();
791-
assert.roughEqual(scrollable.scrollHeight(), dateTableHeight, 1.01, 'Scroll height > minWorspaceHeight');
767+
QUnit.test(`Workspace vertical scroll should be equal to the dataTable height if grouping, view: '${viewName}', view.intervalCount=${intervalCount}, height: ${height}`, async function(assert) {
768+
const scheduler = await createWrapper({
769+
height: height,
770+
views: [{
771+
type: viewName,
772+
name: viewName,
773+
intervalCount: intervalCount
774+
}],
775+
currentView: viewName,
776+
groups: ['any'],
777+
resources: [{
778+
fieldExpr: 'any',
779+
dataSource: [
780+
{ text: 'Group_1', id: 1 },
781+
{ text: 'Group_2', id: 2 },
782+
{ text: 'Group_3', id: 3 }
783+
],
784+
}],
792785
});
786+
787+
const dateTableHeight = scheduler.workSpace.getDateTableHeight();
788+
const scrollable = scheduler.workSpace.getScrollable();
789+
assert.roughEqual(scrollable.scrollHeight(), dateTableHeight, 1.01, 'Scroll height > minWorspaceHeight');
793790
});
794791
});
795792
});

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

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -575,60 +575,57 @@ QUnit.test('Grouped multi-week appointments should have a correct left offset',
575575

576576
});
577577

578-
[true, false].forEach((renovateRender) => {
579-
QUnit.test(`Grouped multi-week appointments should have a correct left offset in rtl mode when renovateRender is ${renovateRender}`, async function(assert) {
578+
QUnit.test('Grouped multi-week appointments should have a correct left offset in rtl mode', async function(assert) {
580579

581-
await this.createInstance({ width: 1052 });
580+
await this.createInstance({ width: 1052 });
582581

583-
mockWorkSpaceRendering.call(this, this.instance, 50, [700, 350, 0]);
582+
mockWorkSpaceRendering.call(this, this.instance, 50, [700, 350, 0]);
584583

585-
this.instance.option({
586-
views: ['month'],
587-
currentView: 'month',
588-
firstDayOfWeek: 1,
589-
currentDate: new Date(2015, 1, 9),
590-
rtlEnabled: true,
591-
dataSource: [],
592-
resources: [
593-
{
594-
field: 'roomId',
595-
dataSource: [
596-
{ id: 1, text: 'One' },
597-
{ id: 2, text: 'Two' },
598-
{ id: 3, text: 'Three' }
599-
]
600-
}
601-
],
602-
groups: ['roomId'],
603-
renovateRender,
604-
});
605-
await waitAsync(0);
606-
607-
this.instance.option('dataSource', [{
608-
text: 'a',
609-
startDate: new Date(2015, 1, 10),
610-
endDate: new Date(2015, 1, 25),
611-
roomId: [1, 2]
612-
}]);
613-
await waitAsync(0);
614-
615-
const $appointments = $(this.instance.$element()).find('.dx-scheduler-appointment');
616-
const leftOffsets = [
617-
translator.locate($appointments.eq(0)).left,
618-
translator.locate($appointments.eq(1)).left,
619-
translator.locate($appointments.eq(2)).left,
620-
translator.locate($appointments.eq(3)).left,
621-
translator.locate($appointments.eq(4)).left,
622-
translator.locate($appointments.eq(5)).left
623-
].sort();
624-
625-
assert.roughEqual(leftOffsets[0], 350, 1);
626-
assert.roughEqual(leftOffsets[1], 350, 1);
627-
assert.roughEqual(leftOffsets[2], 600, 1);
628-
assert.roughEqual(leftOffsets[3], 700, 1);
629-
assert.roughEqual(leftOffsets[4], 700, 1);
630-
assert.roughEqual(leftOffsets[5], 950, 1);
584+
this.instance.option({
585+
views: ['month'],
586+
currentView: 'month',
587+
firstDayOfWeek: 1,
588+
currentDate: new Date(2015, 1, 9),
589+
rtlEnabled: true,
590+
dataSource: [],
591+
resources: [
592+
{
593+
field: 'roomId',
594+
dataSource: [
595+
{ id: 1, text: 'One' },
596+
{ id: 2, text: 'Two' },
597+
{ id: 3, text: 'Three' }
598+
]
599+
}
600+
],
601+
groups: ['roomId'],
631602
});
603+
await waitAsync(0);
604+
605+
this.instance.option('dataSource', [{
606+
text: 'a',
607+
startDate: new Date(2015, 1, 10),
608+
endDate: new Date(2015, 1, 25),
609+
roomId: [1, 2]
610+
}]);
611+
await waitAsync(0);
612+
613+
const $appointments = $(this.instance.$element()).find('.dx-scheduler-appointment');
614+
const leftOffsets = [
615+
translator.locate($appointments.eq(0)).left,
616+
translator.locate($appointments.eq(1)).left,
617+
translator.locate($appointments.eq(2)).left,
618+
translator.locate($appointments.eq(3)).left,
619+
translator.locate($appointments.eq(4)).left,
620+
translator.locate($appointments.eq(5)).left
621+
].sort();
622+
623+
assert.roughEqual(leftOffsets[0], 350, 1);
624+
assert.roughEqual(leftOffsets[1], 350, 1);
625+
assert.roughEqual(leftOffsets[2], 600, 1);
626+
assert.roughEqual(leftOffsets[3], 700, 1);
627+
assert.roughEqual(leftOffsets[4], 700, 1);
628+
assert.roughEqual(leftOffsets[5], 950, 1);
632629
});
633630

634631
QUnit.test('Multi-week grouped appointments should be painted correctly', async function(assert) {

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

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -239,29 +239,26 @@ QUnit.module('Integration: Resources', moduleConfig, () => {
239239
assert.equal(getHexColor($appointments.eq(1)), '#0000ff', 'Color is OK');
240240
});
241241

242-
[true, false].forEach((renovateRender) => {
243-
QUnit.test(`Resources should be set correctly is the resources[].dataSource option is changed(T396746) when renovateRender is ${renovateRender}`, async function(assert) {
244-
const resourceData = [{ id: 1, text: 'John', color: 'red' }];
245-
246-
const { instance } = await createWrapper({
247-
dataSource: [],
248-
currentDate: new Date(2015, 4, 26),
249-
groups: ['ownerId'],
250-
resources: [{
251-
fieldExpr: 'ownerId',
252-
dataSource: []
253-
}],
254-
renovateRender,
255-
});
256-
257-
instance.option('resources[0].dataSource', resourceData);
258-
await waitAsync(0);
242+
QUnit.test('Resources should be set correctly is the resources[].dataSource option is changed(T396746)', async function(assert) {
243+
const resourceData = [{ id: 1, text: 'John', color: 'red' }];
259244

260-
assert.deepEqual(instance.option('resources'), [{
245+
const { instance } = await createWrapper({
246+
dataSource: [],
247+
currentDate: new Date(2015, 4, 26),
248+
groups: ['ownerId'],
249+
resources: [{
261250
fieldExpr: 'ownerId',
262-
dataSource: resourceData
263-
}], 'Resources were changed correctly');
251+
dataSource: []
252+
}],
264253
});
254+
255+
instance.option('resources[0].dataSource', resourceData);
256+
await waitAsync(0);
257+
258+
assert.deepEqual(instance.option('resources'), [{
259+
fieldExpr: 'ownerId',
260+
dataSource: resourceData
261+
}], 'Resources were changed correctly');
265262
});
266263

267264
QUnit.test('Appointment should have correct color after resources option changing', async function(assert) {

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,10 @@ if((new Date(2020, 2, 7)).getTimezoneOffset() === pacificTimezoneOffset) {
254254
{ view: 'timelineWeek', times: expectedAllTimes, dates: expectedDateResults }
255255
];
256256

257-
[true, false].forEach((renovateRender) => {
257+
{
258258
module('timeCellTemplate', () => {
259259
testCases.forEach(testCase => {
260-
test(`arguments should be valid in '${testCase.view}' view when renovateRender is ${renovateRender}`, async function(assert) {
260+
test(`arguments should be valid in '${testCase.view}' view`, async function(assert) {
261261
let index = 0;
262262

263263
await createWrapper({
@@ -275,13 +275,13 @@ if((new Date(2020, 2, 7)).getTimezoneOffset() === pacificTimezoneOffset) {
275275
startDayHour: 0,
276276
currentDate: summerDSTDate,
277277
height: 600,
278-
renovateRender,
278+
279279
});
280280

281281
assert.expect(expectedAllTimes.length * 2);
282282
});
283283

284-
test(`template args should be valid in '${testCase.view}' view when startViewDate is during DST change when renovateRender is ${renovateRender}`, async function(assert) {
284+
test(`template args should be valid in '${testCase.view}' view when startViewDate is during DST change`, async function(assert) {
285285
let index = 0;
286286

287287
const validExpectedDateResults = testCase.dates.slice(4);
@@ -302,7 +302,7 @@ if((new Date(2020, 2, 7)).getTimezoneOffset() === pacificTimezoneOffset) {
302302
startDayHour: 2,
303303
currentDate: summerDSTDate,
304304
height: 600,
305-
renovateRender,
305+
306306
});
307307

308308
assert.expect(times.length * 2);
@@ -319,7 +319,7 @@ if((new Date(2020, 2, 7)).getTimezoneOffset() === pacificTimezoneOffset) {
319319
});
320320
})
321321
.forEach((testCase) => {
322-
test(`template args should be valid in '${testCase.view}' view when startViewDate is during DST change when renovateRender is ${renovateRender}`, async function(assert) {
322+
test(`template args should be valid in '${testCase.view}' view when startViewDate is during DST change`, async function(assert) {
323323
let index = 0;
324324

325325
const validExpectedDateResults = expectedDateResults.slice(4);
@@ -348,14 +348,14 @@ if((new Date(2020, 2, 7)).getTimezoneOffset() === pacificTimezoneOffset) {
348348
startDayHour: 2,
349349
currentDate: summerDSTDate,
350350
height: 600,
351-
renovateRender,
351+
352352
});
353353

354354
assert.expect(validExpectedDateResults.length);
355355
});
356356
});
357357
});
358-
});
358+
}
359359

360360
module('Time panel render', () => {
361361
testCases.forEach(testCase => {

0 commit comments

Comments
 (0)