This repository has been archived by the owner on May 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
466 additions
and
526 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
describe('typeaheadHighlight', function () { | ||
|
||
describe('typeaheadHighlight', function() { | ||
var highlightFilter; | ||
|
||
beforeEach(module('ui.bootstrap.typeahead')); | ||
beforeEach(inject(function (typeaheadHighlightFilter) { | ||
beforeEach(inject(function(typeaheadHighlightFilter) { | ||
highlightFilter = typeaheadHighlightFilter; | ||
})); | ||
|
||
it('should higlight a match', function () { | ||
it('should higlight a match', function() { | ||
expect(highlightFilter('before match after', 'match')).toEqual('before <strong>match</strong> after'); | ||
}); | ||
|
||
it('should higlight a match with mixed case', function () { | ||
it('should higlight a match with mixed case', function() { | ||
expect(highlightFilter('before MaTch after', 'match')).toEqual('before <strong>MaTch</strong> after'); | ||
}); | ||
|
||
it('should higlight all matches', function () { | ||
it('should higlight all matches', function() { | ||
expect(highlightFilter('before MaTch after match', 'match')).toEqual('before <strong>MaTch</strong> after <strong>match</strong>'); | ||
}); | ||
|
||
it('should do nothing if no match', function () { | ||
it('should do nothing if no match', function() { | ||
expect(highlightFilter('before match after', 'nomatch')).toEqual('before match after'); | ||
}); | ||
|
||
it('should do nothing if no or empty query', function () { | ||
it('should do nothing if no or empty query', function() { | ||
expect(highlightFilter('before match after', '')).toEqual('before match after'); | ||
expect(highlightFilter('before match after', null)).toEqual('before match after'); | ||
expect(highlightFilter('before match after', undefined)).toEqual('before match after'); | ||
}); | ||
|
||
it('issue 316 - should work correctly for regexp reserved words', function () { | ||
it('issue 316 - should work correctly for regexp reserved words', function() { | ||
expect(highlightFilter('before (match after', '(match')).toEqual('before <strong>(match</strong> after'); | ||
}); | ||
|
||
it('issue 1777 - should work correctly with numeric values', function () { | ||
it('issue 1777 - should work correctly with numeric values', function() { | ||
expect(highlightFilter(123, '2')).toEqual('1<strong>2</strong>3'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.