-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstraw-android-ui-plugin-spec.js
76 lines (44 loc) · 1.76 KB
/
straw-android-ui-plugin-spec.js
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var describe = window.describe;
var it = window.it;
var expect = window.expect;
var sinon = window.sinon;
var straw = window.straw;
describe('ui', function () {
'use strict';
it('exists', function () {
expect(typeof straw.ui).toEqual('object');
});
var TOAST_MESSAGE = 'toast message';
describe('toast', function () {
it('is defined and is a function', function () {
expect(typeof straw.ui.toast).toBe('function');
});
it('invokes straw.execute with appropriate arguments', function () {
var spy = sinon.spy(straw, 'exec');
straw.ui.toast(TOAST_MESSAGE);
// UI plugin's toast action was called
expect(spy.getCall(0).args[0]).toBe('ui');
expect(spy.getCall(0).args[1]).toBe('toast');
// parameters are correct
expect(typeof spy.getCall(0).args[2]).toBe('object');
expect(spy.getCall(0).args[2].text).toBe(TOAST_MESSAGE);
straw.exec.restore();
});
});
describe('toast', function () {
it('is defined and is a function', function () {
expect(typeof straw.ui.toastLong).toBe('function');
});
it('invokes straw.execute with appropriate arguments', function () {
var spy = sinon.spy(straw, 'exec');
straw.ui.toastLong(TOAST_MESSAGE);
// UI plugin's toast action was called
expect(spy.getCall(0).args[0]).toBe('ui');
expect(spy.getCall(0).args[1]).toBe('toastLong');
// parameters are correct
expect(typeof spy.getCall(0).args[2]).toBe('object');
expect(spy.getCall(0).args[2].text).toBe(TOAST_MESSAGE);
straw.exec.restore();
});
});
});