Skip to content

Commit f1c3170

Browse files
committed
Cleanup unused function and redundant variable assignment
1 parent 5f5a057 commit f1c3170

File tree

3 files changed

+1
-63
lines changed

3 files changed

+1
-63
lines changed

src/scripts/choices.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,8 +1367,6 @@ class Choices {
13671367
return;
13681368
}
13691369

1370-
const hasUnactiveChoices = this._store.choices.some((option) => !option.active);
1371-
13721370
// Check that we have a value to search and the input was an alphanumeric character
13731371
if (value !== null && typeof value !== 'undefined' && value.length >= this.config.searchFloor) {
13741372
const resultCount = this.config.searchChoices ? this._searchChoices(value) : 0;
@@ -1379,7 +1377,7 @@ class Choices {
13791377
resultCount,
13801378
});
13811379
}
1382-
} else if (hasUnactiveChoices) {
1380+
} else if (this._store.choices.some((option) => !option.active)) {
13831381
this._stopSearch();
13841382
}
13851383
}

src/scripts/components/list.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ export default class List {
1313
this.height = this.element.offsetHeight;
1414
}
1515

16-
clear(): void {
17-
this.element.innerHTML = '';
18-
}
19-
2016
prepend(node: Element | DocumentFragment): void {
2117
const child = this.element.firstElementChild;
2218
if (child) {

test/scripts/components/list.test.ts

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -36,62 +36,6 @@ describe('components/list', () => {
3636
});
3737
});
3838

39-
describe('clear', () => {
40-
it("clears element's inner HTML", () => {
41-
expect(instance).to.not.be.null;
42-
if (!instance) {
43-
return;
44-
}
45-
const innerHTML = 'test';
46-
instance.element.innerHTML = innerHTML;
47-
expect(instance.element.innerHTML).to.equal(innerHTML);
48-
instance.clear();
49-
expect(instance.element.innerHTML).to.equal('');
50-
});
51-
});
52-
53-
describe('append', () => {
54-
it('appends passed node to element', () => {
55-
expect(instance).to.not.be.null;
56-
if (!instance) {
57-
return;
58-
}
59-
const elementToAppend = document.createElement('span');
60-
const childClass = 'test-element';
61-
elementToAppend.classList.add(...getClassNames(childClass));
62-
expect(instance.element.querySelector(`.${childClass}`)).to.equal(null);
63-
instance.element.append(elementToAppend);
64-
expect(instance.element.querySelector(`.${childClass}`)).to.equal(elementToAppend);
65-
});
66-
});
67-
68-
describe('hasChildren', () => {
69-
describe('when list has children', () => {
70-
it('returns true', () => {
71-
expect(instance).to.not.be.null;
72-
if (!instance) {
73-
return;
74-
}
75-
const childElement = document.createElement('span');
76-
instance.element.appendChild(childElement);
77-
const response = instance.element.hasChildNodes();
78-
expect(response).to.equal(true);
79-
});
80-
});
81-
82-
describe('when list does not have children', () => {
83-
it('returns false', () => {
84-
expect(instance).to.not.be.null;
85-
if (!instance) {
86-
return;
87-
}
88-
instance.element.innerHTML = '';
89-
const response = instance.element.hasChildNodes();
90-
expect(response).to.equal(false);
91-
});
92-
});
93-
});
94-
9539
describe('scrollToTop', () => {
9640
it("sets the position's scroll position to 0", () => {
9741
expect(instance).to.not.be.null;

0 commit comments

Comments
 (0)