-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.js
More file actions
133 lines (113 loc) · 3.28 KB
/
helpers.js
File metadata and controls
133 lines (113 loc) · 3.28 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
define([
'intern!object',
'intern/chai!assert',
'intern/order!source/js/helpers.js'
], function (registerSuite, assert) {
registerSuite({
name: 'helpers',
beforeEach: function () {
window = {
navigator: {
userAgent: ''
}
};
screen = {
width: 0
};
minic = {
desktop: function (screenWidth) {
window.navigator.userAgent = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36';
screen.width = screenWidth || 992;
},
tablet: function (screenWidth) {
window.navigator.userAgent = 'Mozilla/5.0 (iPad; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5';
screen.width = screenWidth || 750;
},
mobile: function (screenWidth) {
window.navigator.userAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4';
screen.width = screenWidth || 767;
}
};
},
'#hasMobileUA': {
'should be true': function () {
minic.mobile();
assert.isTrue( hasMobileUA() );
minic.tablet();
assert.isTrue( hasMobileUA() );
},
'should be false': function () {
minic.desktop();
assert.isFalse( hasMobileUA() );
}
},
'#isDesktop': {
'should be true': function () {
minic.desktop(992);
assert.isTrue( isDesktop() );
minic.desktop(1200);
assert.isTrue( isDesktop() );
},
'should be false': function () {
minic.mobile();
assert.isFalse( isDesktop() );
minic.tablet(992);
assert.isFalse( isDesktop() );
}
},
'#isTablet': {
'should be true': function () {
minic.tablet(900);
assert.isTrue( isTablet() );
minic.tablet(780);
assert.isTrue( isTablet() );
},
'should be false': function () {
minic.desktop(500);
assert.isFalse( isTablet() );
minic.tablet(1000);
assert.isFalse( isTablet() );
minic.tablet(500);
assert.isFalse( isTablet() );
}
},
'#isMobile': {
'should be true': function () {
minic.mobile();
assert.isTrue( isMobile() );
minic.mobile(700);
assert.isTrue( isMobile() );
},
'should be false': function () {
minic.desktop();
assert.isFalse( isMobile() );
minic.tablet();
assert.isFalse( isMobile() );
minic.mobile(1000);
assert.isFalse( isMobile() );
}
},
'#escapeSelector': function () {
var selectors = ['(something', '.something', '$something'];
selectors.forEach(function (s) {
assert.equal( escapeSelector(s), '\\' + s );
});
},
'#displaySidebar': function () {},
'#isMist': {
beforeEach: function () {
CONFIG = {
scheme: ''
};
},
'should be true': function () {
CONFIG.scheme = 'Mist';
assert.isTrue( isMist() );
},
'should be false': function () {
CONFIG.scheme = 'Minimal';
assert.isFalse( isMist() );
}
}
});
});