blob: 86ef420bb2f5faf2200812f471b4edd95200aec2 (
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
describeComponent('mail_view/ui/attachment_icon', function () {
'use strict';
describe('attachment', function () {
beforeEach(function () {
Pixelated.mockBloodhound();
this.setupComponent();
});
it('should render attachment button if feature enabled', function () {
expect(this.$node.html()).toMatch('<i class="fa fa-paperclip"></i>');
});
it('should be busy', function() {
this.component.uploadInProgress();
expect(this.component.attr.busy).toBe(true);
});
it('should be busy after upload event', function() {
$(document).trigger(Pixelated.events.mail.uploadingAttachment);
expect(this.component.attr.busy).toBe(true);
});
it('should not be busy', function() {
this.component.uploadFinished();
expect(this.component.attr.busy).toBe(false);
});
it('should not be busy after upload finished event', function() {
$(document).trigger(Pixelated.events.mail.uploadedAttachment);
expect(this.component.attr.busy).toBe(false);
});
it('should not be busy after upload failed event', function() {
$(document).trigger(Pixelated.events.mail.failedUploadAttachment);
expect(this.component.attr.busy).toBe(false);
});
it('should trigger start of attachment upload process', function () {
var triggerUploadAttachment = spyOnEvent(document, Pixelated.events.mail.startUploadAttachment);
this.$node.click();
expect(triggerUploadAttachment).toHaveBeenTriggeredOn(document);
});
it('should not trigger attachment upload when busy', function () {
this.component.uploadInProgress();
var triggerUploadAttachment = spyOnEvent(document, Pixelated.events.mail.startUploadAttachment);
this.$node.click();
expect(triggerUploadAttachment).not.toHaveBeenTriggeredOn(document);
});
});
});
|