diff options
author | Christoph <c@kluenter.de> | 2016-03-09 15:37:18 +0100 |
---|---|---|
committer | Christoph <c@kluenter.de> | 2016-03-09 15:37:18 +0100 |
commit | 3994188a0e4d9468518132f179eb56fab7760fbe (patch) | |
tree | 224e5d536b9a6c4859671b2cff57f1f60236ef9f /web-ui/test/spec/search/results_highlighter.spec.js | |
parent | 281f88ba668e38883e822ea5bd96134ad3a3aa6c (diff) | |
parent | 23b175742f20d96e5b5d3d9cfcc0ed7067197f92 (diff) |
Merge pull request #636 from pixelated/dev/sandbox
Dev/sandbox
Diffstat (limited to 'web-ui/test/spec/search/results_highlighter.spec.js')
-rw-r--r-- | web-ui/test/spec/search/results_highlighter.spec.js | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/web-ui/test/spec/search/results_highlighter.spec.js b/web-ui/test/spec/search/results_highlighter.spec.js index cfb61e9c..13131a8e 100644 --- a/web-ui/test/spec/search/results_highlighter.spec.js +++ b/web-ui/test/spec/search/results_highlighter.spec.js @@ -1,9 +1,11 @@ describeComponent('search/results_highlighter', function () { 'use strict'; - it('highlights words or parts of words that match with the keywords given', function () { + beforeEach(function () { this.setupComponent('<div id="text">Any one seeing too many open bugs</div>'); + }); + it('highlights words or parts of words that match with the keywords given', function () { this.component.attr = {keywords: ['any']}; this.component.highlightResults(event, {where: '#text'}); @@ -12,9 +14,15 @@ describeComponent('search/results_highlighter', function () { expect(highlightedWords).toEqual(2); }); - it('resets highlights when a new search is performed', function() { - this.setupComponent('<div id="text">Any one seeing too many open bugs</div>'); + it('highlights a string with the keywords given', function () { + this.component.attr = {keywords: ['foo']}; + var expectedString = 'the <em class="search-highlight">foo</em> bar'; + var string = this.component.highlightString('the foo bar'); + + expect(string).toEqual(expectedString); + }); + it('resets highlights when a new search is performed', function() { this.component.attr = {keywords: ['any']}; this.component.highlightResults(event, {where: '#text'}); $(document).trigger(Pixelated.events.search.resetHighlight); |