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

Commit

Permalink
Merge pull request #1402 from dontgitit/master
Browse files Browse the repository at this point in the history
fix #1400
  • Loading branch information
aaronroberson committed Jan 27, 2016
2 parents 86e4a82 + e3d6b71 commit dc7f0d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ var uis = angular.module('ui.select', [])
*/
.filter('highlight', function() {
function escapeRegexp(queryToEscape) {
return queryToEscape.replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
return ('' + queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g, '\\$1');
}

return function(matchItem, query) {
Expand Down
7 changes: 7 additions & 0 deletions test/select.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,13 @@ describe('ui-select tests', function() {

expect(highlight(item, query)).toBe('20<span class="ui-select-highlight">15</span>');
});

it('properly works with numeric queries', function() {
var query = 15;
var item = 2015;

expect(highlight(item, query)).toBe('20<span class="ui-select-highlight">15</span>');
});
});

});

1 comment on commit dc7f0d2

@pehrlich
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

Please sign in to comment.