blob: 5e4643500f8d0b9a29eb7383f32dbace0a098d73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
describeComponent("tags/ui/tag_shortcut", function () {
var parent, shortcut, component, TagShortcut;
beforeEach(function () {
TagShortcut = require('tags/ui/tag_shortcut');
component = jasmine.createSpyObj('tagComponent', ['triggerSelect']);
parent = $("<ul>");
shortcut = TagShortcut.appendedTo(parent, { linkTo: { name: 'inbox', counts: { total: 15 }}, trigger: component });
});
it('renders the shortcut inside the parent', function () {
expect(parent.html()).toMatch('<a title="inbox">');
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();
});
});
|