mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 22:31:19 +08:00
FIX: disable by default limitMatches
This commit is contained in:
@ -110,7 +110,11 @@ export default SelectKitComponent.extend({
|
|||||||
computedContent = this.filterComputedContent(computedContent, computedValues, filter);
|
computedContent = this.filterComputedContent(computedContent, computedValues, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.get("limitMatches")) {
|
||||||
return computedContent.slice(0, this.get("limitMatches"));
|
return computedContent.slice(0, this.get("limitMatches"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return computedContent;
|
||||||
},
|
},
|
||||||
|
|
||||||
baseHeaderComputedContent() {
|
baseHeaderComputedContent() {
|
||||||
|
@ -60,7 +60,7 @@ export default Ember.Component.extend(UtilsMixin, PluginApiMixin, DomHelpersMixi
|
|||||||
allowInitialValueMutation: false,
|
allowInitialValueMutation: false,
|
||||||
content: null,
|
content: null,
|
||||||
computedContent: null,
|
computedContent: null,
|
||||||
limitMatches: 100,
|
limitMatches: null,
|
||||||
nameChanges: false,
|
nameChanges: false,
|
||||||
allowContentReplacement: false,
|
allowContentReplacement: false,
|
||||||
collectionHeader: null,
|
collectionHeader: null,
|
||||||
|
@ -88,7 +88,11 @@ export default SelectKitComponent.extend({
|
|||||||
computedContent = this.filterComputedContent(computedContent, computedValue, filter);
|
computedContent = this.filterComputedContent(computedContent, computedValue, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.get("limitMatches")) {
|
||||||
return computedContent.slice(0, this.get("limitMatches"));
|
return computedContent.slice(0, this.get("limitMatches"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return computedContent;
|
||||||
},
|
},
|
||||||
|
|
||||||
@computed("computedValue", "computedContent.[]")
|
@computed("computedValue", "computedContent.[]")
|
||||||
|
@ -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));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
@ -481,7 +481,6 @@ componentTest('with title', {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
componentTest('support modifying header computed content through plugin api', {
|
componentTest('support modifying header computed content through plugin api', {
|
||||||
template: '{{single-select content=content}}',
|
template: '{{single-select content=content}}',
|
||||||
|
|
||||||
@ -505,3 +504,17 @@ componentTest('support modifying header computed content through plugin api', {
|
|||||||
andThen(() => clearCallbacks());
|
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));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Reference in New Issue
Block a user