Skip to content

Commit 2646525

Browse files
author
Jeff
committed
rename filterComparator to filterMatch, fix tests
1 parent 21ec385 commit 2646525

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/components/Select.vue

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -576,15 +576,16 @@
576576
},
577577
578578
/**
579-
* Callback to determine if the provided option
580-
* should match the current search text.
579+
* Callback to determine if the provided option should
580+
* match the current search text. Used to determine
581+
* if the option should be displayed.
581582
* @type {Function}
582583
* @param {Object || String} option
583584
* @param {String} label
584585
* @param {String} search
585586
* @return {Boolean}
586587
*/
587-
filterComparator: {
588+
filterMatch: {
588589
type: Function,
589590
default(option, label, search) {
590591
return (label || '').toLowerCase().indexOf(search.toLowerCase()) > -1
@@ -608,7 +609,7 @@
608609
if (typeof label === 'number') {
609610
label = label.toString()
610611
}
611-
return this.filterComparator(option, label, search)
612+
return this.filterMatch(option, label, search)
612613
});
613614
}
614615
},

test/unit/specs/Select.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ describe('Select.vue', () => {
324324

325325
it('can determine if a given option should match the current search text', () => {
326326
const vm = new Vue({
327-
template: `<div><v-select ref="select" :filterFunction="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`,
327+
template: `<div><v-select ref="select" :filter-match="customFn" :options="[{label: 'Aoo', value: 'foo'}, {label: 'Bar', value: 'bar'}, {label: 'Baz', value: 'baz'}]" v-model="value"></v-select></div>`,
328328
data: {value: 'foo'},
329329
methods:{
330330
customFn: (option, label, search) => label.match(new RegExp('^' + search, 'i'))

0 commit comments

Comments
 (0)