Skip to content

Commit

Permalink
Scheduler(T1202735): Fix QUnits test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Vinogradov committed Dec 11, 2023
1 parent 861e9b0 commit c6d0f89
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,17 @@ module('Current Time Cell Indication Updating', {
view: 'timelineDay',
cellIndices: [4],
timeDifference: HOUR,
highlightedCellsCount: 8,
}, {
view: 'timelineWeek',
cellIndices: [28],
timeDifference: HOUR,
highlightedCellsCount: 8,
}, {
view: 'timelineMonth',
cellIndices: [8],
timeDifference: HOUR * 48,
highlightedCellsCount: 1,
}];

const testBasicView = (assert, scheduler, clock, currentTimeCellsNumber, cellIndices) => {
Expand Down Expand Up @@ -144,7 +147,8 @@ module('Current Time Cell Indication Updating', {
...getBaseConfig({ type: view }),
});

testTimelineView(assert, scheduler, this.clock, timeDifference, 1, cellIndices);
const highlightedCellsCount = view === 'timelineMonth' ? 1 : 8;
testTimelineView(assert, scheduler, this.clock, timeDifference, highlightedCellsCount, cellIndices);
});
});

Expand All @@ -167,15 +171,18 @@ module('Current Time Cell Indication Updating', {
view: 'timelineDay',
cellIndices: [4, 12],
timeDifference: HOUR,
highlightedCellsCount: 16,
}, {
view: 'timelineWeek',
cellIndices: [28, 84],
timeDifference: HOUR,
highlightedCellsCount: 16,
}, {
view: 'timelineMonth',
cellIndices: [8, 39],
timeDifference: HOUR * 48,
}].forEach(({ view, cellIndices, timeDifference }) => {
highlightedCellsCount: 2,
}].forEach(({ view, cellIndices, timeDifference, highlightedCellsCount }) => {
test(`Current Header Panel Cell indication should work correctly when horizontal grouping is used in ${view} view`, function(assert) {
const scheduler = createWrapper({
...getBaseConfig({
Expand All @@ -186,11 +193,11 @@ module('Current Time Cell Indication Updating', {
groups: ['priorityId'],
});

testTimelineView(assert, scheduler, this.clock, timeDifference, 2, cellIndices);
testTimelineView(assert, scheduler, this.clock, timeDifference, highlightedCellsCount, cellIndices);
});
});

timelineViewsConfig.forEach(({ view, cellIndices, timeDifference }) => {
timelineViewsConfig.forEach(({ view, cellIndices, timeDifference, highlightedCellsCount }) => {
test(`Current Header Panel Cell indication should work correctly when grouping by date is used in ${view} view`, function(assert) {
const scheduler = createWrapper({
...getBaseConfig({
Expand All @@ -201,7 +208,7 @@ module('Current Time Cell Indication Updating', {
groups: ['priorityId'],
});

testTimelineView(assert, scheduler, this.clock, timeDifference, 1, cellIndices);
testTimelineView(assert, scheduler, this.clock, timeDifference, highlightedCellsCount, cellIndices);
});
});

Expand All @@ -225,7 +232,7 @@ module('Current Time Cell Indication Updating', {
});
});

timelineViewsConfig.forEach(({ view, cellIndices, timeDifference }) => {
timelineViewsConfig.forEach(({ view, cellIndices, timeDifference, highlightedCellsCount }) => {
test(`Current Header Panel Cell indication should work correctly when vertical is used in ${view} view`, function(assert) {
const scheduler = createWrapper({
...getBaseConfig({
Expand All @@ -235,7 +242,7 @@ module('Current Time Cell Indication Updating', {
groups: ['priorityId'],
});

testTimelineView(assert, scheduler, this.clock, timeDifference, 1, cellIndices);
testTimelineView(assert, scheduler, this.clock, timeDifference, highlightedCellsCount, cellIndices);
});
});

Expand Down Expand Up @@ -279,15 +286,15 @@ module('Current Time Cell Indication Updating', {

let currentTimeCells = scheduler.workSpace.getHeaderPanelCurrentTimeCells();

assert.equal(currentTimeCells.length, 0, 'Correct number of current time cells');
assert.equal(currentTimeCells.length, 2, 'Correct number of current time cells');

this.clock.tick(timeDifference);

const headerPanelCells = scheduler.workSpace.getOrdinaryHeaderPanelCells();
const currentCell = headerPanelCells.eq(cellIndex);
currentTimeCells = scheduler.workSpace.getHeaderPanelCurrentTimeCells();

assert.equal(currentTimeCells.length, 1, 'Correct number of current time cells');
assert.equal(currentTimeCells.length, 2, 'Correct number of current time cells');
assert.ok(currentCell.hasClass(HEADER_PANEL_CURRENT_TIME_CELL_CLASS), 'The current time cell has current-time class');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1624,6 +1624,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: undefined,
groups: undefined,
highlighted: false,
index: 0,
isFirstGroupCell: false,
isLastGroupCell: false,
Expand All @@ -1634,6 +1635,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: undefined,
groups: undefined,
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: false,
Expand Down Expand Up @@ -1661,6 +1663,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10),
groupIndex: undefined,
groups: undefined,
highlighted: false,
index: 0,
isFirstGroupCell: false,
isLastGroupCell: false,
Expand All @@ -1670,6 +1673,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: undefined,
groups: undefined,
highlighted: false,
index: 0,
isFirstGroupCell: false,
isLastGroupCell: false,
Expand All @@ -1680,6 +1684,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: undefined,
groups: undefined,
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: false,
Expand Down Expand Up @@ -1712,6 +1717,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10),
groupIndex: 0,
groups: { groupId: 1 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1721,6 +1727,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: 0,
groups: { groupId: 1 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1731,6 +1738,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: 0,
groups: { groupId: 1 },
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: true,
Expand All @@ -1742,6 +1750,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10),
groupIndex: 1,
groups: { groupId: 2 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1751,6 +1760,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: 1,
groups: { groupId: 2 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1761,6 +1771,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: 1,
groups: { groupId: 2 },
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: true,
Expand Down Expand Up @@ -1792,6 +1803,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: 0,
groups: { groupId: 1 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1802,6 +1814,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: 0,
groups: { groupId: 1 },
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: true,
Expand All @@ -1812,6 +1825,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 5),
groupIndex: 1,
groups: { groupId: 2 },
highlighted: false,
index: 0,
isFirstGroupCell: true,
isLastGroupCell: false,
Expand All @@ -1822,6 +1836,7 @@ module('View Data Provider', {
startDate: new Date(2021, 0, 10, 6),
groupIndex: 1,
groups: { groupId: 2 },
highlighted: false,
index: 1,
isFirstGroupCell: false,
isLastGroupCell: true,
Expand Down

0 comments on commit c6d0f89

Please sign in to comment.