Skip to content

Commit

Permalink
Create and comment test for single dim selection
Browse files Browse the repository at this point in the history
  • Loading branch information
pectom committed Jan 2, 2021
1 parent bf7efc3 commit 5c63f58
Showing 1 changed file with 52 additions and 3 deletions.
55 changes: 52 additions & 3 deletions cypress/integration/e2e/table/edit-schedule-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,35 @@ const workerTestCases: WorkerTestCase[] = [
},
desiredShiftCode: ShiftCode.L4,
},
// TODO: Uncomment after introduction of new range selection
// {
// title: "Should change single row when rectangle with at least row dim is selected",
// startShiftCell: {
// workerType: WorkerType.OTHER,
// workerIdx: 1,
// shiftIdx: 3,
// },
// endShiftCell: {
// workerType: WorkerType.OTHER,
// workerIdx: 3,
// shiftIdx: 6,
// },
// desiredShiftCode: ShiftCode.L4,
// },
// {
// title: "Should change single column when rectangle with bigger row dim is selected",
// startShiftCell: {
// workerType: WorkerType.OTHER,
// workerIdx: 1,
// shiftIdx: 3,
// },
// endShiftCell: {
// workerType: WorkerType.OTHER,
// workerIdx: 3,
// shiftIdx: 2,
// },
// desiredShiftCode: ShiftCode.L4,
// },
];

enum FoundationInfoKeys {
Expand Down Expand Up @@ -122,7 +151,7 @@ function validateHorizontalShifts(
endShiftIdx: number,
desiredShiftCode: ShiftCode
) {
for (const shiftIdx of _.range(startShiftIdx, endShiftIdx)) {
for (const shiftIdx of _.range(startShiftIdx, endShiftIdx + 1)) {
cy.checkWorkerShift({
workerType,
workerIdx,
Expand All @@ -139,7 +168,7 @@ function validateVerticalShifts(
endWorkerIdx: number,
desiredShiftCode: ShiftCode
) {
for (const workerIdx of _.range(startWorkerIdx, endWorkerIdx)) {
for (const workerIdx of _.range(startWorkerIdx, endWorkerIdx + 1)) {
cy.checkWorkerShift({
workerType,
workerIdx,
Expand Down Expand Up @@ -184,6 +213,26 @@ function validateChange({ startShiftCell, endShiftCell, desiredShiftCode }: Work
} else {
cy.log("WRONG TEST SPEC");
throw error;
// TODO: Uncomment after introduction of new range selection
// const workerDim = Math.abs(startWorkerIdx-endWorkerIdx)
// const shiftDim = Math.abs(startShiftIdx-endShiftIdx)
// if(shiftDim >= workerDim){
// validateHorizontalShifts(
// startWorkerType,
// startWorkerIdx,
// startShiftIdx,
// endShiftIdx,
// desiredShiftCode
// );
// }else{
// validateVerticalShifts(
// startWorkerType,
// startShiftIdx,
// startWorkerIdx,
// endWorkerIdx,
// desiredShiftCode
// );
// }
}
}

Expand Down Expand Up @@ -218,7 +267,7 @@ context("Shift range selection", () => {
.eq(endDayIdx)
.trigger("drop")
.type(`${desiredNumber}{enter}`);
for (const dayIdx of _.range(startDayIdx, endDayIdx)) {
for (const dayIdx of _.range(startDayIdx, endDayIdx + 1)) {
cy.get(`[data-cy=foundationInfoSection]`)
.children()
.eq(dataKey)
Expand Down

0 comments on commit 5c63f58

Please sign in to comment.