From fde7bb95e55f612b9433e1f98519d612b6e815ad Mon Sep 17 00:00:00 2001 From: Adilet Soronov <74559101+adiletelf@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:38:56 +0600 Subject: [PATCH 1/4] Fix 'select' method to allow deselecting selection --- CHANGELOG.md | 2 ++ package-lock.json | 4 +-- package.json | 2 +- src/mocks/mockISelectionManager.ts | 55 +++++++++++++++++++++--------- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 768af96..f219152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## 6.1.2 +* Fix 'select' method to allow deselecting selection ## 6.1.1 * powerbi-visuals-api update to 5.9.0 diff --git a/package-lock.json b/package-lock.json index 1639820..d923162 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "powerbi-visuals-utils-testutils", - "version": "6.1.1", + "version": "6.1.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "powerbi-visuals-utils-testutils", - "version": "6.1.1", + "version": "6.1.2", "license": "MIT", "dependencies": { "d3-array": "3.2.4", diff --git a/package.json b/package.json index 0e774cd..51250b1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "powerbi-visuals-utils-testutils", - "version": "6.1.1", + "version": "6.1.2", "description": "powerbi-visuals-utils-testutils", "main": "lib/index.js", "module": "lib/index.js", diff --git a/src/mocks/mockISelectionManager.ts b/src/mocks/mockISelectionManager.ts index 5bc26f6..ec6e89f 100644 --- a/src/mocks/mockISelectionManager.ts +++ b/src/mocks/mockISelectionManager.ts @@ -55,25 +55,46 @@ export class MockISelectionManager implements ISelectionManager { } public select(selectionId: ISelectionId | ISelectionId[], multiSelect?: boolean): IPromise { - const selectionIds: ISelectionId[] = [].concat(selectionId); + const selectionIds: ISelectionId[] = Array.isArray(selectionId) ? selectionId : [selectionId]; - // if no multiselect reset current selection and save new passed selections; - if (!multiSelect) { - this.selectionIds = selectionIds; + if (selectionIds.length < 1) { + return new Promise((resolve, reject) => { + resolve(this.selectionIds); + }) as any; + } + + if (selectionIds.length > 1) { + // the new selection is a set of points + if (multiSelect) { + // if multiSelect is truthy, toggle the selection state of each selectionId + selectionIds.forEach(id => { + const index = this.selectionIds.findIndex(selectedId => selectedId.equals(id)); + if (index > -1) { + this.selectionIds.splice(index, 1); + } else { + this.selectionIds.push(id); + } + }); + } else { + // if an array of selectionIds are passed in, assume multiSelect and set the selection to be the new set that is selected + this.selectionIds = selectionIds; + } + } else if (this.containsSelection(selectionIds[0])) { + // the selectionId that was selected is a subset of what is already selected + if (multiSelect) { + // if multiSelect is on, deselect the selected id + this.selectionIds = this.selectionIds.filter(x => !selectionIds[0].equals(x)); + } else { + // if multiSelect is off, the selected item is the new selectedId, else deselect the selection + this.selectionIds = selectionIds.length > 1 ? selectionIds : []; + } } else { - // if multiselect then check all passed selections - selectionIds.forEach( (id: ISelectionId) => { - // if selectionManager has passed selection in list of current selections - if (this.containsSelection(id)) { - // need to exclude from selection (selection of selected element should deselect element) - this.selectionIds = this.selectionIds.filter((selectedId: ISelectionId) => { - return !selectedId.equals(id); - }); - } else { - // otherwise include the new selection into current selections - this.selectionIds.push(id); - } - }); + // the selectionId that was selected is not a subset of what is already selected + if (multiSelect) { + this.selectionIds.push(selectionIds[0]); + } else { + this.selectionIds = selectionIds; + } } return new Promise((resolve, reject) => { From 37463f2392b8dc800b1687831775e63e327c73e2 Mon Sep 17 00:00:00 2001 From: Adilet Soronov <74559101+adiletelf@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:46:38 +0600 Subject: [PATCH 2/4] Check if 'callback' is defined in MockISelectionManager --- CHANGELOG.md | 1 + src/mocks/mockISelectionManager.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f219152..745e824 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 6.1.2 * Fix 'select' method to allow deselecting selection +* Check if 'callback' is defined in MockISelectionManager ## 6.1.1 * powerbi-visuals-api update to 5.9.0 diff --git a/src/mocks/mockISelectionManager.ts b/src/mocks/mockISelectionManager.ts index ec6e89f..e299473 100644 --- a/src/mocks/mockISelectionManager.ts +++ b/src/mocks/mockISelectionManager.ts @@ -133,6 +133,8 @@ export class MockISelectionManager implements ISelectionManager { } public simutateSelection(selections: ISelectionId[]): void { - this.callback(selections); + if (this.callback && typeof this.callback === "function") { + this.callback(selections); + } } } From bfbefb3fcfd917b0a6e358bf382ed5aaece46d3c Mon Sep 17 00:00:00 2001 From: Adilet Soronov <74559101+adiletelf@users.noreply.github.com> Date: Thu, 12 Dec 2024 14:47:59 +0600 Subject: [PATCH 3/4] Add tests for MockISelectionManager --- CHANGELOG.md | 1 + test/mocks/mockISelectionManagerTest.ts | 250 ++++++++++++++++++++++++ 2 files changed, 251 insertions(+) create mode 100644 test/mocks/mockISelectionManagerTest.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 745e824..82bbfd0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 6.1.2 * Fix 'select' method to allow deselecting selection * Check if 'callback' is defined in MockISelectionManager +* Add tests for MockISelectionManager ## 6.1.1 * powerbi-visuals-api update to 5.9.0 diff --git a/test/mocks/mockISelectionManagerTest.ts b/test/mocks/mockISelectionManagerTest.ts new file mode 100644 index 0000000..c2d7f50 --- /dev/null +++ b/test/mocks/mockISelectionManagerTest.ts @@ -0,0 +1,250 @@ +/* + * Power BI Visualizations + * + * Copyright (c) Microsoft Corporation + * All rights reserved. + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the ""Software""), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +import powerbi from "powerbi-visuals-api"; +import { createSelectionId } from "../../src/mocks/mocks"; +import { MockISelectionManager } from "../../src/mocks/mockISelectionManager"; + +import ISelectionId = powerbi.visuals.ISelectionId; + +describe("MockISelectionManager", () => { + let selectionManager: MockISelectionManager; + + beforeEach(() => { + selectionManager = new MockISelectionManager(); + }); + + describe("clear", () => { + it("should have an empty selection", () => { + expect(selectionManager.hasSelection()).toBeFalsy(); + }); + + it("should clear the selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + selectionManager.clear(); + + expect(selectionManager.getSelectionIds()).toHaveSize(0); + expect(selectionManager.hasSelection()).toBeFalsy(); + }) + }); + + describe("hasSelection", () => { + it("should return false when there is no selection", () => { + expect(selectionManager.hasSelection()).toBeFalsy(); + }); + + it("should return true when there is a selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + + expect(selectionManager.hasSelection()).toBeTruthy(); + }); + + it("should return false when the selection is cleared", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + selectionManager.clear(); + + expect(selectionManager.hasSelection()).toBeFalsy(); + }); + + it("should return false when selection is toggled", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + selectionManager.select(selectionId); + + expect(selectionManager.hasSelection()).toBeFalsy(); + }); + }); + + describe("getSelectionIds", () => { + it("should return an empty array when there is no selection", () => { + expect(selectionManager.getSelectionIds()).toHaveSize(0); + }); + + it("should return an array with a selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(1); + }); + }); + + describe("containsSelection", () => { + it("should return false when there is no selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + expect(selectionManager.containsSelection(selectionId)).toBeFalsy(); + }); + + it("should return true when the selection is present", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + + expect(selectionManager.containsSelection(selectionId)).toBeTruthy(); + }); + + it("should return false when the selection is not present", () => { + const selectionId: ISelectionId = createSelectionId("1"); + const otherSelectionId: ISelectionId = createSelectionId("2"); + + selectionManager.select(selectionId); + + expect(selectionManager.containsSelection(otherSelectionId)).toBeFalsy(); + }); + }); + + describe("select", () => { + it("should add a selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(1); + expect(selectedIds[0].equals(selectionId)).toBeTruthy(); + }); + + it("should toggle a selection", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + selectionManager.select(selectionId); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(0); + }); + + it("should replace a selection", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId0); + selectionManager.select(selectionId1); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(1); + expect(selectedIds[0].equals(selectionId1)).toBeTruthy(); + }); + + it("should not update the selection when selection array is empty", () => { + const selectionId: ISelectionId = createSelectionId("1"); + + selectionManager.select(selectionId); + selectionManager.select([]); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(1); + expect(selectedIds[0].equals(selectionId)).toBeTruthy(); + }) + + it("should add multiple selections at once", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + const selectionId2: ISelectionId = createSelectionId("2"); + + selectionManager.select([selectionId0, selectionId1, selectionId2]); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(3); + expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); + expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); + expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); + }); + + it("should add multiple selections with multiSelection", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + const selectionId2: ISelectionId = createSelectionId("2"); + + selectionManager.select(selectionId0); + selectionManager.select(selectionId1, true); + selectionManager.select(selectionId2, true); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(3); + expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); + expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); + expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); + }); + + it("should toggle a selection with multiSelection", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + const selectionId2: ISelectionId = createSelectionId("2"); + + selectionManager.select([selectionId0, selectionId1, selectionId2]); + selectionManager.select(selectionId2, true); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(2); + expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); + expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); + }); + + it("should replace a selection with passed array of selectionIds", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + const selectionId2: ISelectionId = createSelectionId("2"); + const selectionId3: ISelectionId = createSelectionId("3"); + + selectionManager.select([selectionId0, selectionId1]); + selectionManager.select([selectionId2, selectionId3]); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(2); + expect(selectedIds[0].equals(selectionId0)).toBeFalsy(); + expect(selectedIds[1].equals(selectionId1)).toBeFalsy(); + expect(selectedIds[0].equals(selectionId2)).toBeTruthy(); + expect(selectedIds[1].equals(selectionId3)).toBeTruthy(); + }); + + it("should merge a selection with passed array of selectionIds", () => { + const selectionId0: ISelectionId = createSelectionId("0"); + const selectionId1: ISelectionId = createSelectionId("1"); + const selectionId2: ISelectionId = createSelectionId("2"); + const selectionId3: ISelectionId = createSelectionId("3"); + + selectionManager.select([selectionId0, selectionId1]); + selectionManager.select([selectionId2, selectionId3], true); + + const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); + expect(selectedIds).toHaveSize(4); + expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); + expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); + expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); + expect(selectedIds[3].equals(selectionId3)).toBeTruthy(); + }); + }); +}); \ No newline at end of file From 0e8eb35ac1b4b78c1eeada5e5db5898b83f157a4 Mon Sep 17 00:00:00 2001 From: Adilet Soronov <74559101+adiletelf@users.noreply.github.com> Date: Fri, 13 Dec 2024 16:08:51 +0600 Subject: [PATCH 4/4] Refactor select method in MockISelectionManager to improve selection handling and update tests for consistency --- CHANGELOG.md | 2 +- src/mocks/mockISelectionManager.ts | 52 ++++++++++++++----------- test/mocks/mockISelectionManagerTest.ts | 38 +++++++++--------- 3 files changed, 50 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82bbfd0..4970098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ ## 6.1.2 -* Fix 'select' method to allow deselecting selection +* Fix 'select' method in MockISelectionManager to allow deselecting selection * Check if 'callback' is defined in MockISelectionManager * Add tests for MockISelectionManager diff --git a/src/mocks/mockISelectionManager.ts b/src/mocks/mockISelectionManager.ts index e299473..cf82506 100644 --- a/src/mocks/mockISelectionManager.ts +++ b/src/mocks/mockISelectionManager.ts @@ -57,44 +57,52 @@ export class MockISelectionManager implements ISelectionManager { public select(selectionId: ISelectionId | ISelectionId[], multiSelect?: boolean): IPromise { const selectionIds: ISelectionId[] = Array.isArray(selectionId) ? selectionId : [selectionId]; - if (selectionIds.length < 1) { + if (selectionIds.length === 0) { return new Promise((resolve, reject) => { resolve(this.selectionIds); }) as any; } - if (selectionIds.length > 1) { - // the new selection is a set of points + const handleMultipleSelection = ((selectionIds: ISelectionId[]) => { if (multiSelect) { - // if multiSelect is truthy, toggle the selection state of each selectionId + // add new selection and toggle existing selection selectionIds.forEach(id => { - const index = this.selectionIds.findIndex(selectedId => selectedId.equals(id)); - if (index > -1) { - this.selectionIds.splice(index, 1); + const matchingIndex = this.selectionIds.findIndex(selectedId => selectedId.equals(id)); + if (matchingIndex > -1) { + this.selectionIds.splice(matchingIndex, 1); } else { this.selectionIds.push(id); } }); } else { - // if an array of selectionIds are passed in, assume multiSelect and set the selection to be the new set that is selected + // replace the current selection with the new selection this.selectionIds = selectionIds; } - } else if (this.containsSelection(selectionIds[0])) { - // the selectionId that was selected is a subset of what is already selected - if (multiSelect) { - // if multiSelect is on, deselect the selected id - this.selectionIds = this.selectionIds.filter(x => !selectionIds[0].equals(x)); + }); + + const handleSingleSelection = ((selectionId: ISelectionId) => { + const matchingIndex = this.selectionIds.findIndex(selectedId => selectedId.equals(selectionId)); + if (matchingIndex > -1) { + // the selection is already selected, so we need to deselect it + if (multiSelect) { + this.selectionIds.splice(matchingIndex, 1); + } else { + this.selectionIds = []; + } } else { - // if multiSelect is off, the selected item is the new selectedId, else deselect the selection - this.selectionIds = selectionIds.length > 1 ? selectionIds : []; + // the selection is off, so we need to select it + if (multiSelect) { + this.selectionIds.push(selectionId); + } else { + this.selectionIds = [selectionId]; + } } + }); + + if (selectionIds.length > 1) { + handleMultipleSelection(selectionIds); } else { - // the selectionId that was selected is not a subset of what is already selected - if (multiSelect) { - this.selectionIds.push(selectionIds[0]); - } else { - this.selectionIds = selectionIds; - } + handleSingleSelection(selectionIds[0]); } return new Promise((resolve, reject) => { @@ -133,7 +141,7 @@ export class MockISelectionManager implements ISelectionManager { } public simutateSelection(selections: ISelectionId[]): void { - if (this.callback && typeof this.callback === "function") { + if (typeof this.callback === "function") { this.callback(selections); } } diff --git a/test/mocks/mockISelectionManagerTest.ts b/test/mocks/mockISelectionManagerTest.ts index c2d7f50..7ceca15 100644 --- a/test/mocks/mockISelectionManagerTest.ts +++ b/test/mocks/mockISelectionManagerTest.ts @@ -133,7 +133,7 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(1); - expect(selectedIds[0].equals(selectionId)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId); }); it("should toggle a selection", () => { @@ -155,7 +155,7 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(1); - expect(selectedIds[0].equals(selectionId1)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId1); }); it("should not update the selection when selection array is empty", () => { @@ -166,7 +166,7 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(1); - expect(selectedIds[0].equals(selectionId)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId); }) it("should add multiple selections at once", () => { @@ -178,9 +178,9 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(3); - expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); - expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); - expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId0); + expect(selectedIds[1]).toEqual(selectionId1); + expect(selectedIds[2]).toEqual(selectionId2); }); it("should add multiple selections with multiSelection", () => { @@ -194,9 +194,9 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(3); - expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); - expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); - expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId0); + expect(selectedIds[1]).toEqual(selectionId1); + expect(selectedIds[2]).toEqual(selectionId2); }); it("should toggle a selection with multiSelection", () => { @@ -209,8 +209,8 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(2); - expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); - expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId0); + expect(selectedIds[1]).toEqual(selectionId1); }); it("should replace a selection with passed array of selectionIds", () => { @@ -224,10 +224,10 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(2); - expect(selectedIds[0].equals(selectionId0)).toBeFalsy(); - expect(selectedIds[1].equals(selectionId1)).toBeFalsy(); - expect(selectedIds[0].equals(selectionId2)).toBeTruthy(); - expect(selectedIds[1].equals(selectionId3)).toBeTruthy(); + expect(selectedIds[0]).not.toEqual(selectionId0); + expect(selectedIds[1]).not.toEqual(selectionId1); + expect(selectedIds[0]).toEqual(selectionId2); + expect(selectedIds[1]).toEqual(selectionId3); }); it("should merge a selection with passed array of selectionIds", () => { @@ -241,10 +241,10 @@ describe("MockISelectionManager", () => { const selectedIds: ISelectionId[] = selectionManager.getSelectionIds(); expect(selectedIds).toHaveSize(4); - expect(selectedIds[0].equals(selectionId0)).toBeTruthy(); - expect(selectedIds[1].equals(selectionId1)).toBeTruthy(); - expect(selectedIds[2].equals(selectionId2)).toBeTruthy(); - expect(selectedIds[3].equals(selectionId3)).toBeTruthy(); + expect(selectedIds[0]).toEqual(selectionId0); + expect(selectedIds[1]).toEqual(selectionId1); + expect(selectedIds[2]).toEqual(selectionId2); + expect(selectedIds[3]).toEqual(selectionId3); }); }); }); \ No newline at end of file