diff options
author | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-01-06 16:19:36 -0200 |
---|---|---|
committer | Alexandre Pretto Nunes <anunes@thoughtworks.com> | 2015-01-06 16:45:48 -0200 |
commit | b0720edaa0d51ee9e807495fa536d890d332c50d (patch) | |
tree | f3f1021ded39bafaeb24adca837c65477c36ad1f /web-ui/test/spec/tags/ui/tag.spec.js | |
parent | 45c4d0b4ccfe8619438d3e9752624b639feaea3d (diff) |
Update tests to refactored events behaviour
Diffstat (limited to 'web-ui/test/spec/tags/ui/tag.spec.js')
-rw-r--r-- | web-ui/test/spec/tags/ui/tag.spec.js | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/web-ui/test/spec/tags/ui/tag.spec.js b/web-ui/test/spec/tags/ui/tag.spec.js index 3bc0c7fc..36fc83f2 100644 --- a/web-ui/test/spec/tags/ui/tag.spec.js +++ b/web-ui/test/spec/tags/ui/tag.spec.js @@ -23,7 +23,6 @@ describeComponent('tags/ui/tag', function () { this.component.$node.click(); - expect(this.component.attr.selected).toBeTruthy(); expect(this.$node.attr('class')).toMatch('selected'); expect(tagSelectEvent).toHaveBeenTriggeredOnAndWith(document, { tag: 'inbox' }); }); @@ -94,6 +93,18 @@ describeComponent('tags/ui/tag', function () { $(document).trigger(Pixelated.events.mail.read, { tags: ['inbox']}); expect(this.$node.html()).not.toMatch('"unread-count"'); }); + + it('should not be selected when a search is performed', function() { + this.component.trigger(document, Pixelated.events.search.perform); + + expect(this.component.$node).not.toHaveClass('selected'); + }); + + it('should not be selected when the search is cleared', function() { + this.component.trigger(document, Pixelated.events.search.empty); + + expect(this.component.$node).not.toHaveClass('selected'); + }); }); describe('drafts tag', function () { @@ -149,6 +160,17 @@ describeComponent('tags/ui/tag', function () { expect(this.$node.attr('class')).not.toMatch('searching'); }); + it('should be selected when a search is performed', function() { + this.component.trigger(document, Pixelated.events.search.perform); + + expect(this.component.$node).toHaveClass('selected'); + }); + + it('should be selected when the search is cleared', function() { + this.component.trigger(document, Pixelated.events.search.empty); + + expect(this.component.$node).toHaveClass('selected'); + }); }); _.each(['sent', 'trash'], function (tag_name) { |