Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit dc7f0d2

Browse files
committed
Merge pull request #1402 from dontgitit/master
fix #1400
2 parents 86e4a82 + e3d6b71 commit dc7f0d2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ var uis = angular.module('ui.select', [])
135135
*/
136136
.filter('highlight', function() {
137137
function escapeRegexp(queryToEscape) {
138-
return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
138+
return ('' + queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
139139
}
140140

141141
return function(matchItem, query) {

test/select.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2328,6 +2328,13 @@ describe('ui-select tests', function() {
23282328

23292329
expect(highlight(item, query)).toBe('20<span class="ui-select-highlight">15</span>');
23302330
});
2331+
2332+
it('properly works with numeric queries', function() {
2333+
var query = 15;
2334+
var item = 2015;
2335+
2336+
expect(highlight(item, query)).toBe('20<span class="ui-select-highlight">15</span>');
2337+
});
23312338
});
23322339

23332340
});

0 commit comments

Comments
 (0)