FIX: disable by default limitMatches

This commit is contained in:
Joffrey JAFFEUX 2018-01-11 09:54:39 +01:00 committed by GitHub
parent 3ec2024466
commit 3ee7b18886
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 39 additions and 4 deletions

View File

@ -110,7 +110,11 @@ export default SelectKitComponent.extend({
computedContent = this.filterComputedContent(computedContent, computedValues, filter);
}
return computedContent.slice(0, this.get("limitMatches"));
if (this.get("limitMatches")) {
return computedContent.slice(0, this.get("limitMatches"));
}
return computedContent;
},
baseHeaderComputedContent() {

View File

@ -60,7 +60,7 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
allowInitialValueMutation: false,
content: null,
computedContent: null,
limitMatches: 100,
limitMatches: null,
nameChanges: false,
allowContentReplacement: false,
collectionHeader: null,

View File

@ -88,7 +88,11 @@ export default SelectKitComponent.extend({
computedContent = this.filterComputedContent(computedContent, computedValue, filter);
}
return computedContent.slice(0, this.get("limitMatches"));
if (this.get("limitMatches")) {
return computedContent.slice(0, this.get("limitMatches"));
}
return computedContent;
},
@computed("computedValue", "computedContent.[]")

View File

@ -145,3 +145,17 @@ componentTest('interactions', {
});
}
});
componentTest('with limitMatches', {
template: '{{multi-select content=content limitMatches=2}}',
beforeEach() {
this.set('content', ['sam', 'jeff', 'neil']);
},
test(assert) {
this.get('subject').expand();
andThen(() => assert.equal(this.get('subject').el().find(".select-kit-row").length, 2));
}
});

View File

@ -481,7 +481,6 @@ componentTest('with title', {
}
});
componentTest('support modifying header computed content through plugin api', {
template: '{{single-select content=content}}',
@ -505,3 +504,17 @@ componentTest('support modifying header computed content through plugin api', {
andThen(() => clearCallbacks());
}
});
componentTest('with limitMatches', {
template: '{{single-select content=content limitMatches=2}}',
beforeEach() {
this.set('content', ['sam', 'jeff', 'neil']);
},
test(assert) {
this.get('subject').expand();
andThen(() => assert.equal(this.get('subject').el().find(".select-kit-row").length, 2));
}
});