summaryrefslogtreecommitdiff
path: root/web-ui/test/spec
diff options
context:
space:
mode:
Diffstat (limited to 'web-ui/test/spec')
-rw-r--r--web-ui/test/spec/tags/ui/tag_list.spec.js16
-rw-r--r--web-ui/test/spec/tags/ui/tag_shortcut.spec.js57
2 files changed, 0 insertions, 73 deletions
diff --git a/web-ui/test/spec/tags/ui/tag_list.spec.js b/web-ui/test/spec/tags/ui/tag_list.spec.js
index 9391a30a..f92f72af 100644
--- a/web-ui/test/spec/tags/ui/tag_list.spec.js
+++ b/web-ui/test/spec/tags/ui/tag_list.spec.js
@@ -80,30 +80,14 @@ describeComponent('tags/ui/tag_list', function () {
expect(defaultTags).toEqual(['tag-2']);
});
- it('resets the tag shortcuts when loading tags', function () {
- var tagList = [tag('inbox', 1, true)];
- $(document).trigger(Pixelated.events.tags.received, {tags: tagList});
-
- tagList = [tag('sent', 1, true)];
- $(document).trigger(Pixelated.events.tags.received, {tags: tagList});
-
- var shortcuts = _.map($('#tags-shortcuts').find('li'), function (el) {
- return $(el).text().trim();
- });
-
- expect(shortcuts).toEqual(['sent']);
- });
-
it('sends teardown events when loading new tags', function () {
var tagsTeardownCustom = spyOnEvent(this.component.select('customTagList'), Pixelated.events.tags.teardown);
var tagsTeardownDefault = spyOnEvent(this.component.select('defaultTagList'), Pixelated.events.tags.teardown);
- var tagsShortcutsTeardown = spyOnEvent(document, Pixelated.events.tags.shortcuts.teardown);
$(document).trigger(Pixelated.events.tags.received, {tags: []});
expect(tagsTeardownCustom).toHaveBeenTriggeredOn(this.component.select('customTagList'));
expect(tagsTeardownDefault).toHaveBeenTriggeredOn(this.component.select('defaultTagList'));
- expect(tagsShortcutsTeardown).toHaveBeenTriggeredOn(document);
});
});
});
diff --git a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js b/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
deleted file mode 100644
index fe235541..00000000
--- a/web-ui/test/spec/tags/ui/tag_shortcut.spec.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* global jasmine */
-/* global Pixelated */
-
-describeComponent('tags/ui/tag_shortcut', function () {
- 'use strict';
-
- var parent, shortcut, component, TagShortcut;
-
- beforeEach(function () {
- TagShortcut = require('tags/ui/tag_shortcut');
-
- component = jasmine.createSpyObj('tagComponent', ['triggerSelect']);
- parent = $('<ul>');
- $('body').append(parent);
- shortcut = TagShortcut.appendedTo(parent, { tag: { name: 'inbox', counts: { total: 15 }}, trigger: component });
- });
-
- afterEach(function () {
- $('body')[0].removeChild(parent[0]);
- });
-
- it('renders the shortcut inside the parent', function () {
- expect(parent.html()).toMatch('<i class="fa fa-inbox"></i>');
- expect(parent.html()).toMatch('<div class="shortcut-label">inbox</div>');
- });
-
- it('selects and unselect on tag.select', function () {
- $(document).trigger(Pixelated.events.ui.tag.select, { tag: 'inbox'});
-
- expect(shortcut.$node).toHaveClass('selected');
-
- $(document).trigger(Pixelated.events.ui.tag.select, { tag: 'sent'});
-
- expect(shortcut.$node).not.toHaveClass('selected');
- });
-
- it('delegates the click to linked tag', function (){
- shortcut.$node.click();
-
- expect(component.triggerSelect).toHaveBeenCalled();
- });
-
- it('teardown shortcuts on event but only if they are not in the DOM', function () {
- parent.empty();
- var shortcutAddedAfterEmptyingParent = TagShortcut.appendedTo(parent, { tag: { name: 'inbox', counts: { total: 15 }}, trigger: component });
- // by now shorcut is not in the DOM anymore but shortcutAddedAfterEmptyingParent is
-
- spyOn(shortcut, 'teardown').and.callThrough();
- spyOn(shortcutAddedAfterEmptyingParent, 'teardown').and.callThrough();
-
- $(document).trigger(Pixelated.events.tags.shortcuts.teardown);
-
- expect(shortcut.teardown).toHaveBeenCalled();
- expect(shortcutAddedAfterEmptyingParent.teardown).not.toHaveBeenCalled();
- });
-});
-