Skip to content

Commit 5d87aa4

Browse files
author
Patricio Albizu
committed
fix: roll back to last PR with variable renaming
1 parent 0eb4e99 commit 5d87aa4

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

projects/components/src/multi-select/multi-select.component.test.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,10 @@ describe('Multi Select Component', () => {
9393
});
9494

9595
spectator.tick();
96-
const checkboxElements = spectator.queryAll('ht-checkbox', { root: true });
97-
expect(checkboxElements.length).toBe(6);
96+
const selectedCheckboxElements = spectator.queryAll('ht-checkbox', { root: true });
97+
expect(
98+
selectedCheckboxElements.filter(checkboxElement => checkboxElement.getAttribute('ng-reflect-checked') === 'true').length
99+
).toBe(2);
98100
}));
99101

100102
test('should display provided options with icons when clicked', fakeAsync(() => {
@@ -123,8 +125,10 @@ describe('Multi Select Component', () => {
123125
expect(spectator.query('.multi-select-content', { root: true })).toExist();
124126
expect(optionElements.length).toBe(6);
125127

126-
const checkboxElements = spectator.queryAll('ht-checkbox', { root: true });
127-
expect(checkboxElements.length).toBe(6);
128+
const selectedCheckboxElements = spectator.queryAll('ht-checkbox', { root: true });
129+
expect(
130+
selectedCheckboxElements.filter(checkboxElement => checkboxElement.getAttribute('ng-reflect-checked') === 'true').length
131+
).toBe(2);
128132

129133
optionElements.forEach((element, index) => {
130134
expect(element).toHaveText(selectionOptions[index].label);
@@ -219,7 +223,11 @@ describe('Multi Select Component', () => {
219223

220224
spectator.tick();
221225

222-
expect(spectator.queryAll('ht-checkbox', { root: true }).length).toBe(6);
226+
expect(
227+
spectator
228+
.queryAll('ht-checkbox', { root: true })
229+
.filter(checkboxElement => checkboxElement.getAttribute('ng-reflect-checked') === 'true').length
230+
).toBe(0);
223231
expect(onChange).toHaveBeenCalledTimes(1);
224232
expect(onChange).toHaveBeenLastCalledWith([]);
225233
expect(spectator.query(LabelComponent)?.label).toEqual('Select options');
@@ -229,8 +237,8 @@ describe('Multi Select Component', () => {
229237
spectator.click(allOptionElement!);
230238

231239
spectator.tick();
232-
const selectedElements = spectator.queryAll('ht-checkbox', { root: true });
233-
expect(selectedElements.length).toBe(6);
240+
const selectedCheckboxElements = spectator.queryAll('ht-checkbox', { root: true });
241+
expect(selectedCheckboxElements.length).toBe(6);
234242

235243
expect(onChange).toHaveBeenCalledWith(selectionOptions.map(option => option.value));
236244
expect(spectator.query(LabelComponent)?.label).toEqual('first and 5 more');

0 commit comments

Comments
 (0)