Skip to content

Commit 2bbdffe

Browse files
committed
Fix autocomplete unit tests
1 parent b463ef2 commit 2bbdffe

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Autocomplete/assets/dist/controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ var controller_default = class extends Controller {
8787
urlValueChanged() {
8888
this.resetTomSelect();
8989
}
90-
getMaxOptions() {
90+
getMaxOptions(hasRemoteData = false) {
9191
if (this.maxOptionsValue) {
9292
return this.maxOptionsValue;
9393
}
94-
if (this.selectElement) {
94+
if (!hasRemoteData && this.selectElement) {
9595
return this.selectElement.options.length;
9696
}
9797
return 50;
@@ -348,7 +348,7 @@ createAutocompleteWithRemoteData_fn = function(autocompleteEndpointUrl, minChara
348348
}
349349
return query.length >= 3;
350350
},
351-
maxOptions: this.getMaxOptions(),
351+
maxOptions: this.getMaxOptions(true),
352352
optgroupField: "group_by",
353353
// avoid extra filtering after results are returned
354354
score: (search) => (item) => 1,

src/Autocomplete/assets/src/controller.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ export default class extends Controller {
294294

295295
return query.length >= 3;
296296
},
297-
maxOptions: this.getMaxOptions(),
297+
maxOptions: this.getMaxOptions(true),
298298
optgroupField: 'group_by',
299299
// avoid extra filtering after results are returned
300300
score: (search: string) => (item: any) => 1,
@@ -320,12 +320,12 @@ export default class extends Controller {
320320
return this.#createTomSelect(config);
321321
}
322322

323-
private getMaxOptions(): number {
323+
private getMaxOptions(hasRemoteData: boolean = false): number {
324324
if (this.maxOptionsValue) {
325325
return this.maxOptionsValue;
326326
}
327327

328-
if (this.selectElement) {
328+
if (!hasRemoteData && this.selectElement) {
329329
return this.selectElement.options.length;
330330
}
331331

0 commit comments

Comments
 (0)