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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
const isMobile = require('../src/isMobile');
describe('Windows', () => {
let mobile;
let userAgent;
beforeEach(() => {
mobile = null;
userAgent = null;
});
describe('Windows Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0)';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows 8.1 Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'//Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Edge Phone UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; <Manufacturer>; <Device>) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166';
mobile = isMobile(userAgent);
});
test('should be a Windows Phone device', () => {
expect(mobile.windows.phone).toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Phone', () => {
expect(mobile.phone).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Tablet UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)';
mobile = isMobile(userAgent);
});
test('should be a Windows Tablet device', () => {
expect(mobile.windows.tablet).toBe(true);
});
test('should not be a Windows Phone device', () => {
expect(mobile.other.windows).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should be matched as Any Tablet', () => {
expect(mobile.tablet).toBe(true);
});
test('should be a mobile device', () => {
expect(mobile.any).toBe(true);
});
});
describe('Windows Touch Laptop UserAgent', () => {
beforeEach(() => {
userAgent =
'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; MAGWJS; rv:11.0) like Gecko';
mobile = isMobile(userAgent);
});
test('should not be a Windows Tablet device', () => {
expect(mobile.windows.tablet).not.toBe(true);
});
test('should not be a Windows Phone device', () => {
expect(mobile.other.windows).not.toBe(true);
});
test('should not be an Android device', () => {
expect(mobile.android.device).not.toBe(true);
});
test('should not be an Apple device', () => {
expect(mobile.apple.device).not.toBe(true);
});
test('should not be matched as Any Tablet', () => {
expect(mobile.tablet).not.toBe(true);
});
test('should not be a mobile device', () => {
expect(mobile.any).not.toBe(true);
});
});
});