webfontloader 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -0
- data/Gemfile +2 -8
- data/README.md +31 -32
- data/Rakefile +2 -33
- data/docs/EVENTS.md +10 -1
- data/docs/MODULES.md +4 -3
- data/lib/webfontloader.rb +1 -1
- data/spec/ascender/ascenderscript_spec.js +43 -0
- data/spec/core/cssclassname_spec.js +42 -0
- data/spec/core/cssfontfamilyname_spec.js +38 -0
- data/spec/core/domhelper_spec.js +158 -0
- data/spec/core/eventdispatcher_spec.js +209 -0
- data/spec/core/font_spec.js +218 -0
- data/spec/core/fontmoduleloader_spec.js +55 -0
- data/spec/core/fontruler_spec.js +33 -0
- data/spec/core/fontvariationdescription_spec.js +67 -0
- data/spec/core/fontwatcher_spec.js +204 -0
- data/spec/core/fontwatchrunner_spec.js +398 -0
- data/spec/core/size_spec.js +17 -0
- data/spec/core/useragentparser_spec.js +921 -0
- data/spec/custom/customcss_spec.js +36 -0
- data/spec/fontdeck/fontdeckscript_spec.js +111 -0
- data/spec/fonts/LICENSE.txt +93 -0
- data/spec/fonts/nullfont.css +1 -0
- data/spec/fonts/nullfont1.css +1 -0
- data/spec/fonts/nullfont2.css +1 -0
- data/spec/fonts/nullfont3.css +1 -0
- data/spec/fonts/sourcesans.eot +0 -0
- data/spec/fonts/sourcesans.otf +0 -0
- data/spec/fonts/sourcesans.svg +2523 -0
- data/spec/fonts/sourcesans.ttf +0 -0
- data/spec/fonts/sourcesans.woff +0 -0
- data/spec/fonts/sourcesansa.css +1 -0
- data/spec/fonts/sourcesansb.css +1 -0
- data/spec/google/fontapiparser_spec.js +348 -0
- data/spec/google/fontapiurlbuilder_spec.js +40 -0
- data/spec/google/googlefontapi_spec.js +123 -0
- data/spec/google/lastresortwebkitfontwatchrunner_spec.js +145 -0
- data/spec/index.html +95 -0
- data/spec/monotype/monotypescript_spec.js +49 -0
- data/spec/typekit/typekitscript_spec.js +93 -0
- data/src/core/domhelper.js +6 -3
- data/src/core/fontruler.js +1 -1
- data/src/core/fontwatcher.js +5 -0
- data/src/core/fontwatchrunner.js +7 -4
- data/src/monotype/monotype_script.js +4 -3
- data/tools/jasmine-phantomjs/jasmine-phantomjs.js +26 -0
- data/tools/jasmine-phantomjs/terminal-reporter.js +177 -0
- data/tools/jasmine/MIT.LICENSE +20 -0
- data/tools/jasmine/jasmine-html.js +681 -0
- data/tools/jasmine/jasmine.css +82 -0
- data/tools/jasmine/jasmine.js +2600 -0
- data/webfontloader.gemspec +46 -25
- metadata +77 -42
- data/src-test/ascender/ascender_script_test.js +0 -51
- data/src-test/core/cssclassnametest.js +0 -42
- data/src-test/core/cssfontfamilynametest.js +0 -54
- data/src-test/core/domhelpertest.js +0 -151
- data/src-test/core/eventdispatchertest.js +0 -275
- data/src-test/core/fontmoduleloadertest.js +0 -30
- data/src-test/core/fonttest.js +0 -121
- data/src-test/core/fontvariationdescriptiontest.js +0 -76
- data/src-test/core/fontwatchertest.js +0 -287
- data/src-test/core/fontwatchrunnertest.js +0 -454
- data/src-test/core/useragenttest.js +0 -755
- data/src-test/custom/customcsstest.js +0 -35
- data/src-test/fontdeck/fontdeck_script_test.js +0 -116
- data/src-test/google/fontapiparsertest.js +0 -252
- data/src-test/google/fontapiurlbuildertest.js +0 -71
- data/src-test/google/googlefontapitest.js +0 -185
- data/src-test/google/lastresortwebkitfontwatchrunnertest.js +0 -204
- data/src-test/monotype/monotype_script_test.js +0 -304
- data/src-test/typekit/typekit_script_test.js +0 -195
- data/tools/jstestdriver/JsTestDriver-1.2.1.jar +0 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
describe('Size', function () {
|
2
|
+
var Size = webfont.Size;
|
3
|
+
|
4
|
+
it('should return true on identical sizes', function () {
|
5
|
+
expect(new Size(10, 10).equals(new Size(10, 10))).toBe(true);
|
6
|
+
});
|
7
|
+
|
8
|
+
it('should return false when two sizes are different', function () {
|
9
|
+
expect(new Size(10, 10).equals(new Size(20, 20))).toBe(false);
|
10
|
+
expect(new Size(10, 10).equals(new Size(10, 20))).toBe(false);
|
11
|
+
});
|
12
|
+
|
13
|
+
it('should return false when one font is undefined or null', function () {
|
14
|
+
expect(new Size(10, 10).equals(undefined)).toBe(false);
|
15
|
+
expect(new Size(10, 10).equals(null)).toBe(false);
|
16
|
+
});
|
17
|
+
});
|
@@ -0,0 +1,921 @@
|
|
1
|
+
describe('UserAgentParser', function () {
|
2
|
+
var UserAgentParser = webfont.UserAgentParser;
|
3
|
+
|
4
|
+
beforeEach(function () {
|
5
|
+
this.addMatchers({
|
6
|
+
toMatchUserAgent: function (expected) {
|
7
|
+
var actual = this.actual,
|
8
|
+
notText = this.isNot ? 'not' : '';
|
9
|
+
|
10
|
+
function msg(description, actual, expected) {
|
11
|
+
return function () {
|
12
|
+
return 'Expected ' + description + ' ' + actual + notText + ' to match ' + expected;
|
13
|
+
};
|
14
|
+
}
|
15
|
+
|
16
|
+
if (actual.getName() !== expected.name) {
|
17
|
+
this.message = msg('name', actual.getName(), expected.name);
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
|
21
|
+
if (actual.getVersion() !== expected.version) {
|
22
|
+
this.message = msg('version', actual.getVersion(), expected.version);
|
23
|
+
return false;
|
24
|
+
}
|
25
|
+
|
26
|
+
if (actual.getPlatform() !== expected.platform) {
|
27
|
+
this.message = msg('platform', actual.getPlatform(), expected.platform);
|
28
|
+
return false;
|
29
|
+
}
|
30
|
+
|
31
|
+
if (actual.getPlatformVersion() !== expected.platformVersion) {
|
32
|
+
this.message = msg('platform version', actual.getPlatformVersion(), expected.platformVersion);
|
33
|
+
return false;
|
34
|
+
}
|
35
|
+
|
36
|
+
if (actual.getEngine() !== expected.engine) {
|
37
|
+
this.message = msg('engine', actual.getEngine(), expected.engine);
|
38
|
+
return false;
|
39
|
+
}
|
40
|
+
|
41
|
+
if (actual.getEngineVersion() !== expected.engineVersion) {
|
42
|
+
this.message = msg('engine version', actual.getEngineVersion(), expected.engineVersion);
|
43
|
+
return false;
|
44
|
+
}
|
45
|
+
|
46
|
+
if (actual.getDocumentMode() !== expected.documentMode) {
|
47
|
+
this.message = msg('document mode', actual.getDocumentMode(), expected.documentMode);
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
|
51
|
+
if (actual.getBrowserInfo().hasWebFontSupport() !== expected.browserInfo.hasWebFontSupport) {
|
52
|
+
this.message = msg('web font support', actual.getBrowserInfo().hasWebFontSupport(), expected.browserInfo.hasWebFontSupport);
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
|
56
|
+
if (actual.getBrowserInfo().hasWebKitFallbackBug() !== expected.browserInfo.hasWebKitFallbackBug) {
|
57
|
+
this.message = msg('web kit fallback bug', actual.getBrowserInfo().hasWebKitFallbackBug(), expected.browserInfo.hasWebKitFallbackBug);
|
58
|
+
return false;
|
59
|
+
}
|
60
|
+
|
61
|
+
return true;
|
62
|
+
}
|
63
|
+
});
|
64
|
+
});
|
65
|
+
|
66
|
+
describe('#parse', function () {
|
67
|
+
function parse(userAgentString, doc) {
|
68
|
+
return new UserAgentParser(userAgentString, doc || {}).parse();
|
69
|
+
}
|
70
|
+
|
71
|
+
describe('Adobe Air', function () {
|
72
|
+
it('should detect Adobe Air', function () {
|
73
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5'))
|
74
|
+
.toMatchUserAgent({
|
75
|
+
name: 'AdobeAIR',
|
76
|
+
version: '2.5',
|
77
|
+
platform: 'Macintosh',
|
78
|
+
platformVersion: 'Unknown',
|
79
|
+
engine: 'AppleWebKit',
|
80
|
+
engineVersion: '531.9',
|
81
|
+
documentMode: undefined,
|
82
|
+
browserInfo: {
|
83
|
+
hasWebFontSupport: true,
|
84
|
+
hasWebKitFallbackBug: true
|
85
|
+
}
|
86
|
+
});
|
87
|
+
});
|
88
|
+
|
89
|
+
it('should detect unsupported Adobe Air browsers', function () {
|
90
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.0'))
|
91
|
+
.toMatchUserAgent({
|
92
|
+
name: 'AdobeAIR',
|
93
|
+
version: '2.0',
|
94
|
+
platform: 'Macintosh',
|
95
|
+
platformVersion: 'Unknown',
|
96
|
+
engine: 'AppleWebKit',
|
97
|
+
engineVersion: '531.9',
|
98
|
+
documentMode: undefined,
|
99
|
+
browserInfo: {
|
100
|
+
hasWebFontSupport: false,
|
101
|
+
hasWebKitFallbackBug: true
|
102
|
+
}
|
103
|
+
});
|
104
|
+
});
|
105
|
+
});
|
106
|
+
|
107
|
+
describe('Firefox', function () {
|
108
|
+
it('should detect Firefox', function () {
|
109
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 GTB7.1'))
|
110
|
+
.toMatchUserAgent({
|
111
|
+
name: 'Firefox',
|
112
|
+
version: '3.6.3',
|
113
|
+
platform: 'Macintosh',
|
114
|
+
platformVersion: '10.5',
|
115
|
+
engine: 'Gecko',
|
116
|
+
engineVersion: '1.9.2.3',
|
117
|
+
documentMode: undefined,
|
118
|
+
browserInfo: {
|
119
|
+
hasWebFontSupport: true,
|
120
|
+
hasWebKitFallbackBug: false
|
121
|
+
}
|
122
|
+
});
|
123
|
+
|
124
|
+
expect(parse('Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.9.2a1pre) Gecko/20090405 Ubuntu/9.04 (jaunty) Firefox/3.6a1pre'))
|
125
|
+
.toMatchUserAgent({
|
126
|
+
name: 'Firefox',
|
127
|
+
version: '3.6a1pre',
|
128
|
+
platform: 'Linux',
|
129
|
+
platformVersion: 'i686',
|
130
|
+
engine: 'Gecko',
|
131
|
+
engineVersion: '1.9.2a1pre',
|
132
|
+
documentMode: undefined,
|
133
|
+
browserInfo: {
|
134
|
+
hasWebFontSupport: true,
|
135
|
+
hasWebKitFallbackBug: false
|
136
|
+
}
|
137
|
+
});
|
138
|
+
});
|
139
|
+
|
140
|
+
it('should detect Firefox 4 beta', function () {
|
141
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1'))
|
142
|
+
.toMatchUserAgent({
|
143
|
+
name: 'Firefox',
|
144
|
+
version: '4.0b1',
|
145
|
+
platform: 'Macintosh',
|
146
|
+
platformVersion: '10.6',
|
147
|
+
engine: 'Gecko',
|
148
|
+
engineVersion: '2.0b1',
|
149
|
+
documentMode: undefined,
|
150
|
+
browserInfo: {
|
151
|
+
hasWebFontSupport: true,
|
152
|
+
hasWebKitFallbackBug: false
|
153
|
+
}
|
154
|
+
});
|
155
|
+
});
|
156
|
+
|
157
|
+
it('should detect Firefox on Android', function () {
|
158
|
+
// This useragent has been slightly doctored with versions to ensure the right
|
159
|
+
// info is coming from the right places.
|
160
|
+
expect(parse('Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/15.0 Firefox/14.0'))
|
161
|
+
.toMatchUserAgent({
|
162
|
+
name: 'Firefox',
|
163
|
+
version: '14.0',
|
164
|
+
platform: 'Android',
|
165
|
+
platformVersion: 'Unknown',
|
166
|
+
engine: 'Gecko',
|
167
|
+
engineVersion: '13.0',
|
168
|
+
documentMode: undefined,
|
169
|
+
browserInfo: {
|
170
|
+
hasWebFontSupport: true,
|
171
|
+
hasWebKitFallbackBug: false
|
172
|
+
}
|
173
|
+
});
|
174
|
+
});
|
175
|
+
|
176
|
+
it('should detect Firefox without version', function () {
|
177
|
+
expect(parse('Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081202 Firefox (Debian-2.0.0.19-0etch1)'))
|
178
|
+
.toMatchUserAgent({
|
179
|
+
name: 'Firefox',
|
180
|
+
version: 'Unknown',
|
181
|
+
platform: 'Linux',
|
182
|
+
platformVersion: 'i686',
|
183
|
+
engine: 'Gecko',
|
184
|
+
engineVersion: '1.8.1.19',
|
185
|
+
documentMode: undefined,
|
186
|
+
browserInfo: {
|
187
|
+
hasWebFontSupport: false,
|
188
|
+
hasWebKitFallbackBug: false
|
189
|
+
}
|
190
|
+
});
|
191
|
+
});
|
192
|
+
});
|
193
|
+
|
194
|
+
describe('Chrome', function () {
|
195
|
+
it('should detect Chrome', function () {
|
196
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2'))
|
197
|
+
.toMatchUserAgent({
|
198
|
+
name: 'Chrome',
|
199
|
+
version: '5.0.342.9',
|
200
|
+
platform: 'Macintosh',
|
201
|
+
platformVersion: '10_5_8',
|
202
|
+
engine: 'AppleWebKit',
|
203
|
+
engineVersion: '533.2',
|
204
|
+
documentMode: undefined,
|
205
|
+
browserInfo: {
|
206
|
+
hasWebFontSupport: true,
|
207
|
+
hasWebKitFallbackBug: true
|
208
|
+
}
|
209
|
+
});
|
210
|
+
});
|
211
|
+
|
212
|
+
it('should detect Chrome on ChromeOS', function () {
|
213
|
+
expect(parse('Mozilla/5.0 (X11; CrOS i686 1660.57.0) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.46 Safari/535.19'))
|
214
|
+
.toMatchUserAgent({
|
215
|
+
name: 'Chrome',
|
216
|
+
version: '18.0.1025.46',
|
217
|
+
platform: 'CrOS',
|
218
|
+
platformVersion: 'i686 1660.57.0',
|
219
|
+
engine: 'AppleWebKit',
|
220
|
+
engineVersion: '535.19',
|
221
|
+
documentMode: undefined,
|
222
|
+
browserInfo: {
|
223
|
+
hasWebFontSupport: true,
|
224
|
+
hasWebKitFallbackBug: true
|
225
|
+
}
|
226
|
+
});
|
227
|
+
});
|
228
|
+
|
229
|
+
it('should detect Chrome on Android', function () {
|
230
|
+
expect(parse('Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Nexus S Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7'))
|
231
|
+
.toMatchUserAgent({
|
232
|
+
name: 'Chrome',
|
233
|
+
version: '16.0.912.75',
|
234
|
+
platform: 'Android',
|
235
|
+
platformVersion: '4.0.3',
|
236
|
+
engine: 'AppleWebKit',
|
237
|
+
engineVersion: '535.7',
|
238
|
+
documentMode: undefined,
|
239
|
+
browserInfo: {
|
240
|
+
hasWebFontSupport: true,
|
241
|
+
hasWebKitFallbackBug: true
|
242
|
+
}
|
243
|
+
});
|
244
|
+
});
|
245
|
+
|
246
|
+
it('should detect Chrome on iPad', function () {
|
247
|
+
expect(parse('Mozilla/5.0 (iPad; U; CPU OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3'))
|
248
|
+
.toMatchUserAgent({
|
249
|
+
name: 'Chrome',
|
250
|
+
version: '19.0.1084.60',
|
251
|
+
platform: 'iPad',
|
252
|
+
platformVersion: '5_1_1',
|
253
|
+
engine: 'AppleWebKit',
|
254
|
+
engineVersion: '534.46.0',
|
255
|
+
documentMode: undefined,
|
256
|
+
browserInfo: {
|
257
|
+
hasWebFontSupport: true,
|
258
|
+
hasWebKitFallbackBug: true
|
259
|
+
}
|
260
|
+
});
|
261
|
+
});
|
262
|
+
|
263
|
+
it('should detect Chrome on iPod', function () {
|
264
|
+
expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 5_1_1 like Mac OS X; en-us) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3'))
|
265
|
+
.toMatchUserAgent({
|
266
|
+
name: 'Chrome',
|
267
|
+
version: '19.0.1084.60',
|
268
|
+
platform: 'iPod',
|
269
|
+
platformVersion: '5_1_1',
|
270
|
+
engine: 'AppleWebKit',
|
271
|
+
engineVersion: '534.46.0',
|
272
|
+
documentMode: undefined,
|
273
|
+
browserInfo: {
|
274
|
+
hasWebFontSupport: true,
|
275
|
+
hasWebKitFallbackBug: true
|
276
|
+
}
|
277
|
+
});
|
278
|
+
});
|
279
|
+
});
|
280
|
+
|
281
|
+
describe('Safari', function () {
|
282
|
+
it('should detect Safari', function () {
|
283
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10'))
|
284
|
+
.toMatchUserAgent({
|
285
|
+
name: 'Safari',
|
286
|
+
version: '4.0.4',
|
287
|
+
platform: 'Macintosh',
|
288
|
+
platformVersion: '10_5_8',
|
289
|
+
engine: 'AppleWebKit',
|
290
|
+
engineVersion: '531.21.8',
|
291
|
+
documentMode: undefined,
|
292
|
+
browserInfo: {
|
293
|
+
hasWebFontSupport: true,
|
294
|
+
hasWebKitFallbackBug: true
|
295
|
+
}
|
296
|
+
});
|
297
|
+
|
298
|
+
expect(parse('Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; tr) AppleWebKit/528.4+ (KHTML, like Gecko) Version/4.0dp1 Safari/526.11.2'))
|
299
|
+
.toMatchUserAgent({
|
300
|
+
name: 'Safari',
|
301
|
+
version: '4.0dp1',
|
302
|
+
platform: 'Macintosh',
|
303
|
+
platformVersion: '10_4_11',
|
304
|
+
engine: 'AppleWebKit',
|
305
|
+
engineVersion: '528.4+',
|
306
|
+
documentMode: undefined,
|
307
|
+
browserInfo: {
|
308
|
+
hasWebFontSupport: true,
|
309
|
+
hasWebKitFallbackBug: true
|
310
|
+
}
|
311
|
+
});
|
312
|
+
});
|
313
|
+
|
314
|
+
it('should detect Safari on iPhone', function () {
|
315
|
+
expect(parse('Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_2 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7D11 Safari/528.16'))
|
316
|
+
.toMatchUserAgent({
|
317
|
+
name: 'Safari',
|
318
|
+
version: '4.0',
|
319
|
+
platform: 'iPhone',
|
320
|
+
platformVersion: '3_1_2',
|
321
|
+
engine: 'AppleWebKit',
|
322
|
+
engineVersion: '528.18',
|
323
|
+
documentMode: undefined,
|
324
|
+
browserInfo: {
|
325
|
+
hasWebFontSupport: true,
|
326
|
+
hasWebKitFallbackBug: true
|
327
|
+
}
|
328
|
+
});
|
329
|
+
});
|
330
|
+
|
331
|
+
it('should detect Safari on iPad', function () {
|
332
|
+
expect(parse('Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10'))
|
333
|
+
.toMatchUserAgent({
|
334
|
+
name: 'Safari',
|
335
|
+
version: '4.0.4',
|
336
|
+
platform: 'iPad',
|
337
|
+
platformVersion: '3_2',
|
338
|
+
engine: 'AppleWebKit',
|
339
|
+
engineVersion: '531.21.10',
|
340
|
+
documentMode: undefined,
|
341
|
+
browserInfo: {
|
342
|
+
hasWebFontSupport: true,
|
343
|
+
hasWebKitFallbackBug: true
|
344
|
+
}
|
345
|
+
});
|
346
|
+
|
347
|
+
expect(parse('Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B360 Safari/531.21.10"'))
|
348
|
+
.toMatchUserAgent({
|
349
|
+
name: 'Safari',
|
350
|
+
version: '4.0.4',
|
351
|
+
platform: 'iPad',
|
352
|
+
platformVersion: '3_2',
|
353
|
+
engine: 'AppleWebKit',
|
354
|
+
engineVersion: '531.21.10',
|
355
|
+
documentMode: undefined,
|
356
|
+
browserInfo: {
|
357
|
+
hasWebFontSupport: true,
|
358
|
+
hasWebKitFallbackBug: true
|
359
|
+
}
|
360
|
+
});
|
361
|
+
|
362
|
+
expect(parse('Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10'))
|
363
|
+
.toMatchUserAgent({
|
364
|
+
name: 'Safari',
|
365
|
+
version: '4.0.4',
|
366
|
+
platform: 'iPad',
|
367
|
+
platformVersion: '3_2',
|
368
|
+
engine: 'AppleWebKit',
|
369
|
+
engineVersion: '531.21.10',
|
370
|
+
documentMode: undefined,
|
371
|
+
browserInfo: {
|
372
|
+
hasWebFontSupport: true,
|
373
|
+
hasWebKitFallbackBug: true
|
374
|
+
}
|
375
|
+
});
|
376
|
+
});
|
377
|
+
|
378
|
+
it('should detect Safari on iPod', function () {
|
379
|
+
expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 2_2_1 like Mac OS X; en-us) AppleWebKit/525.18.1 (KHTML, like Gecko) Mobile/5H11a'))
|
380
|
+
.toMatchUserAgent({
|
381
|
+
name: 'Unknown',
|
382
|
+
version: 'Unknown',
|
383
|
+
platform: 'iPod',
|
384
|
+
platformVersion: '2_2_1',
|
385
|
+
engine: 'AppleWebKit',
|
386
|
+
engineVersion: '525.18.1',
|
387
|
+
documentMode: undefined,
|
388
|
+
browserInfo: {
|
389
|
+
hasWebFontSupport: true,
|
390
|
+
hasWebKitFallbackBug: true
|
391
|
+
}
|
392
|
+
});
|
393
|
+
|
394
|
+
expect(parse('Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7C144 Safari/528.16'))
|
395
|
+
.toMatchUserAgent({
|
396
|
+
name: 'Safari',
|
397
|
+
version: '4.0',
|
398
|
+
platform: 'iPod',
|
399
|
+
platformVersion: '3_1',
|
400
|
+
engine: 'AppleWebKit',
|
401
|
+
engineVersion: '528.18',
|
402
|
+
documentMode: undefined,
|
403
|
+
browserInfo: {
|
404
|
+
hasWebFontSupport: true,
|
405
|
+
hasWebKitFallbackBug: true
|
406
|
+
}
|
407
|
+
});
|
408
|
+
});
|
409
|
+
});
|
410
|
+
|
411
|
+
describe('Internet Explorer', function () {
|
412
|
+
it('should detect Internet Explorer', function () {
|
413
|
+
expect(parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; InfoPath.2; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)'))
|
414
|
+
.toMatchUserAgent({
|
415
|
+
name: 'MSIE',
|
416
|
+
version: '7.0',
|
417
|
+
platform: 'Windows',
|
418
|
+
platformVersion: '5.1',
|
419
|
+
engine: 'MSIE',
|
420
|
+
engineVersion: '7.0',
|
421
|
+
documentMode: undefined,
|
422
|
+
browserInfo: {
|
423
|
+
hasWebFontSupport: true,
|
424
|
+
hasWebKitFallbackBug: false
|
425
|
+
}
|
426
|
+
});
|
427
|
+
|
428
|
+
expect(parse('Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 5.1; Media Center PC 3.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR 2.0.50727; InfoPath.1)'))
|
429
|
+
.toMatchUserAgent({
|
430
|
+
name: 'MSIE',
|
431
|
+
version: '7.0b',
|
432
|
+
platform: 'Windows',
|
433
|
+
platformVersion: '5.1',
|
434
|
+
engine: 'MSIE',
|
435
|
+
engineVersion: '7.0b',
|
436
|
+
documentMode: undefined,
|
437
|
+
browserInfo: {
|
438
|
+
hasWebFontSupport: true,
|
439
|
+
hasWebKitFallbackBug: false
|
440
|
+
}
|
441
|
+
});
|
442
|
+
});
|
443
|
+
|
444
|
+
it('should detect minimal Internet Explorer', function () {
|
445
|
+
expect(parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'))
|
446
|
+
.toMatchUserAgent({
|
447
|
+
name: 'MSIE',
|
448
|
+
version: '7.0',
|
449
|
+
platform: 'Windows',
|
450
|
+
platformVersion: '5.1',
|
451
|
+
engine: 'MSIE',
|
452
|
+
engineVersion: '7.0',
|
453
|
+
documentMode: undefined,
|
454
|
+
browserInfo: {
|
455
|
+
hasWebFontSupport: true,
|
456
|
+
hasWebKitFallbackBug: false
|
457
|
+
}
|
458
|
+
});
|
459
|
+
});
|
460
|
+
|
461
|
+
it('should detect Internet Explorer on Windows Phone', function () {
|
462
|
+
expect(parse('Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device>; <Operator>)'))
|
463
|
+
.toMatchUserAgent({
|
464
|
+
name: 'MSIE',
|
465
|
+
version: '10.0',
|
466
|
+
platform: 'Windows Phone',
|
467
|
+
platformVersion: '8.0',
|
468
|
+
engine: 'MSIE',
|
469
|
+
engineVersion: '10.0',
|
470
|
+
documentMode: undefined,
|
471
|
+
browserInfo: {
|
472
|
+
hasWebFontSupport: true,
|
473
|
+
hasWebKitFallbackBug: false
|
474
|
+
}
|
475
|
+
});
|
476
|
+
});
|
477
|
+
|
478
|
+
it('should detect unsupported Internet Explorer on Windows Phone', function () {
|
479
|
+
expect(parse('Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)'))
|
480
|
+
.toMatchUserAgent({
|
481
|
+
name: 'MSIE',
|
482
|
+
version: '9.0',
|
483
|
+
platform: 'Windows Phone',
|
484
|
+
platformVersion: '7.5',
|
485
|
+
engine: 'MSIE',
|
486
|
+
engineVersion: '9.0',
|
487
|
+
documentMode: undefined,
|
488
|
+
browserInfo: {
|
489
|
+
hasWebFontSupport: false,
|
490
|
+
hasWebKitFallbackBug: false
|
491
|
+
}
|
492
|
+
});
|
493
|
+
});
|
494
|
+
|
495
|
+
it('should detect Internet Explorer on Mac', function () {
|
496
|
+
expect(parse('Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)'))
|
497
|
+
.toMatchUserAgent({
|
498
|
+
name: 'MSIE',
|
499
|
+
version: '5.23',
|
500
|
+
platform: 'Macintosh',
|
501
|
+
platformVersion: 'Unknown',
|
502
|
+
engine: 'MSIE',
|
503
|
+
engineVersion: '5.23',
|
504
|
+
documentMode: undefined,
|
505
|
+
browserInfo: {
|
506
|
+
hasWebFontSupport: false,
|
507
|
+
hasWebKitFallbackBug: false
|
508
|
+
}
|
509
|
+
});
|
510
|
+
});
|
511
|
+
|
512
|
+
it('should detect Internet Explorer with Trident version', function () {
|
513
|
+
expect(parse('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)', { documentMode: 8 }))
|
514
|
+
.toMatchUserAgent({
|
515
|
+
name: 'MSIE',
|
516
|
+
version: '8.0',
|
517
|
+
platform: 'Windows',
|
518
|
+
platformVersion: '6.1',
|
519
|
+
engine: 'MSIE',
|
520
|
+
engineVersion: '8.0',
|
521
|
+
documentMode: 8,
|
522
|
+
browserInfo: {
|
523
|
+
hasWebFontSupport: true,
|
524
|
+
hasWebKitFallbackBug: false
|
525
|
+
}
|
526
|
+
});
|
527
|
+
});
|
528
|
+
});
|
529
|
+
|
530
|
+
describe('Builtin Browser', function () {
|
531
|
+
it('should detect Android builtin browser', function () {
|
532
|
+
expect(parse('Mozilla/5.0 (Linux; U; Android 2.2.1; en-ca; LG-P505R Build/FRG83) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1'))
|
533
|
+
.toMatchUserAgent({
|
534
|
+
name: 'BuiltinBrowser',
|
535
|
+
version: 'Unknown',
|
536
|
+
platform: 'Android',
|
537
|
+
platformVersion: '2.2.1',
|
538
|
+
engine: 'AppleWebKit',
|
539
|
+
engineVersion: '533.1',
|
540
|
+
documentMode: undefined,
|
541
|
+
browserInfo: {
|
542
|
+
hasWebFontSupport: true,
|
543
|
+
hasWebKitFallbackBug: true
|
544
|
+
}
|
545
|
+
});
|
546
|
+
});
|
547
|
+
|
548
|
+
it('should detect unsupported Android builtin browser', function () {
|
549
|
+
expect(parse('Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Nexus One Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17'))
|
550
|
+
.toMatchUserAgent({
|
551
|
+
name: 'BuiltinBrowser',
|
552
|
+
version: 'Unknown',
|
553
|
+
platform: 'Android',
|
554
|
+
platformVersion: '2.1-update1',
|
555
|
+
engine: 'AppleWebKit',
|
556
|
+
engineVersion: '530.17',
|
557
|
+
documentMode: undefined,
|
558
|
+
browserInfo: {
|
559
|
+
hasWebFontSupport: false,
|
560
|
+
hasWebKitFallbackBug: true
|
561
|
+
}
|
562
|
+
});
|
563
|
+
});
|
564
|
+
|
565
|
+
it('should detect Android builtin browser in Desktop mode (Nexus 7)', function () {
|
566
|
+
expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24'))
|
567
|
+
.toMatchUserAgent({
|
568
|
+
name: 'Chrome',
|
569
|
+
version: '11.0.696.34',
|
570
|
+
platform: 'Linux',
|
571
|
+
platformVersion: 'Unknown',
|
572
|
+
engine: 'AppleWebKit',
|
573
|
+
engineVersion: '534.24',
|
574
|
+
documentMode: undefined,
|
575
|
+
browserInfo: {
|
576
|
+
hasWebFontSupport: true,
|
577
|
+
hasWebKitFallbackBug: true
|
578
|
+
}
|
579
|
+
});
|
580
|
+
});
|
581
|
+
|
582
|
+
it('should detect Android builtin browser in Mobile mode (Nexus 7)', function () {
|
583
|
+
expect(parse('Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; sdk Build/MASTER) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30'))
|
584
|
+
.toMatchUserAgent({
|
585
|
+
name: 'BuiltinBrowser',
|
586
|
+
version: 'Unknown',
|
587
|
+
platform: 'Android',
|
588
|
+
platformVersion: '4.1.2',
|
589
|
+
engine: 'AppleWebKit',
|
590
|
+
engineVersion: '534.30',
|
591
|
+
documentMode: undefined,
|
592
|
+
browserInfo: {
|
593
|
+
hasWebFontSupport: true,
|
594
|
+
hasWebKitFallbackBug: true
|
595
|
+
}
|
596
|
+
});
|
597
|
+
});
|
598
|
+
|
599
|
+
it('should detect Android builtin browser in Desktop mode (Nexus S)', function () {
|
600
|
+
expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.34 Safari/534.24'))
|
601
|
+
.toMatchUserAgent({
|
602
|
+
name: 'Chrome',
|
603
|
+
version: '11.0.696.34',
|
604
|
+
platform: 'Linux',
|
605
|
+
platformVersion: 'Unknown',
|
606
|
+
engine: 'AppleWebKit',
|
607
|
+
engineVersion: '534.24',
|
608
|
+
documentMode: undefined,
|
609
|
+
browserInfo: {
|
610
|
+
hasWebFontSupport: true,
|
611
|
+
hasWebKitFallbackBug: true
|
612
|
+
}
|
613
|
+
});
|
614
|
+
});
|
615
|
+
|
616
|
+
it('should detect Android builtin browser in Mobile mode (Nexus S)', function () {
|
617
|
+
expect(parse('Mozilla/5.0 (Linux; U; Android 4.1.2; en-us; Nexus S Build/JZO54K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30'))
|
618
|
+
.toMatchUserAgent({
|
619
|
+
name: 'BuiltinBrowser',
|
620
|
+
version: 'Unknown',
|
621
|
+
platform: 'Android',
|
622
|
+
platformVersion: '4.1.2',
|
623
|
+
engine: 'AppleWebKit',
|
624
|
+
engineVersion: '534.30',
|
625
|
+
documentMode: undefined,
|
626
|
+
browserInfo: {
|
627
|
+
hasWebFontSupport: true,
|
628
|
+
hasWebKitFallbackBug: true
|
629
|
+
}
|
630
|
+
});
|
631
|
+
});
|
632
|
+
|
633
|
+
it('should detect BlackBerry 10 as supporting web fonts', function () {
|
634
|
+
expect(parse('Mozilla/5.0 (BB10; Touch) AppleWebKit/537.3+ (KHTML, like Gecko) Version/10.0.9.388 Mobile Safari/537.3+'))
|
635
|
+
.toMatchUserAgent({
|
636
|
+
name: 'BuiltinBrowser',
|
637
|
+
version: 'Unknown',
|
638
|
+
platform: 'BlackBerry',
|
639
|
+
platformVersion: '10.0.9.388',
|
640
|
+
engine: 'AppleWebKit',
|
641
|
+
engineVersion: '537.3+',
|
642
|
+
documentMode: undefined,
|
643
|
+
browserInfo: {
|
644
|
+
hasWebFontSupport: true,
|
645
|
+
hasWebKitFallbackBug: false
|
646
|
+
}
|
647
|
+
});
|
648
|
+
});
|
649
|
+
|
650
|
+
it('should detect BlackBerry < 10 as not supporting web fonts', function () {
|
651
|
+
expect(parse('Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+'))
|
652
|
+
.toMatchUserAgent({
|
653
|
+
name: 'BuiltinBrowser',
|
654
|
+
version: 'Unknown',
|
655
|
+
platform: 'BlackBerry',
|
656
|
+
platformVersion: '7.1.0.346',
|
657
|
+
engine: 'AppleWebKit',
|
658
|
+
engineVersion: '534.11+',
|
659
|
+
documentMode: undefined,
|
660
|
+
browserInfo: {
|
661
|
+
hasWebFontSupport: false,
|
662
|
+
hasWebKitFallbackBug: true
|
663
|
+
}
|
664
|
+
});
|
665
|
+
});
|
666
|
+
});
|
667
|
+
|
668
|
+
describe('Opera', function () {
|
669
|
+
it('should detect Opera', function () {
|
670
|
+
expect(parse('Opera/9.80 (Linux i686; U; en) Presto/2.5.22 Version/10.51'))
|
671
|
+
.toMatchUserAgent({
|
672
|
+
name: 'Opera',
|
673
|
+
version: '10.51',
|
674
|
+
platform: 'Linux',
|
675
|
+
platformVersion: 'i686',
|
676
|
+
engine: 'Presto',
|
677
|
+
engineVersion: '2.5.22',
|
678
|
+
documentMode: undefined,
|
679
|
+
browserInfo: {
|
680
|
+
hasWebFontSupport: true,
|
681
|
+
hasWebKitFallbackBug: false
|
682
|
+
}
|
683
|
+
});
|
684
|
+
});
|
685
|
+
|
686
|
+
it('should detect Opera with Firefox in useragent', function () {
|
687
|
+
expect(parse('Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70'))
|
688
|
+
.toMatchUserAgent({
|
689
|
+
name: 'Opera',
|
690
|
+
version: '9.70',
|
691
|
+
platform: 'Linux',
|
692
|
+
platformVersion: 'i686',
|
693
|
+
engine: 'Gecko',
|
694
|
+
engineVersion: '1.8.1',
|
695
|
+
documentMode: undefined,
|
696
|
+
browserInfo: {
|
697
|
+
hasWebFontSupport: false,
|
698
|
+
hasWebKitFallbackBug: false
|
699
|
+
}
|
700
|
+
});
|
701
|
+
});
|
702
|
+
|
703
|
+
it('should detect Opera before v10', function () {
|
704
|
+
expect(parse('Opera/9.64 (X11; Linux i686; U; Linux Mint; nb) Presto/2.1.1'))
|
705
|
+
.toMatchUserAgent({
|
706
|
+
name: 'Opera',
|
707
|
+
version: '9.64',
|
708
|
+
platform: 'Linux',
|
709
|
+
platformVersion: 'i686',
|
710
|
+
engine: 'Presto',
|
711
|
+
engineVersion: '2.1.1',
|
712
|
+
documentMode: undefined,
|
713
|
+
browserInfo: {
|
714
|
+
hasWebFontSupport: false,
|
715
|
+
hasWebKitFallbackBug: false
|
716
|
+
}
|
717
|
+
});
|
718
|
+
});
|
719
|
+
|
720
|
+
it('should detect Opera Mobile on Android', function () {
|
721
|
+
expect(parse('Opera/9.80 (Android 4.1.1; Linux; Opera Mobi/ADR-1207201819; U; en) Presto/2.10.254 Version/12.00'))
|
722
|
+
.toMatchUserAgent({
|
723
|
+
name: 'Opera',
|
724
|
+
version: '12.00',
|
725
|
+
platform: 'Android',
|
726
|
+
platformVersion: '4.1.1',
|
727
|
+
engine: 'Presto',
|
728
|
+
engineVersion: '2.10.254',
|
729
|
+
documentMode: undefined,
|
730
|
+
browserInfo: {
|
731
|
+
hasWebFontSupport: true,
|
732
|
+
hasWebKitFallbackBug: false
|
733
|
+
}
|
734
|
+
});
|
735
|
+
});
|
736
|
+
|
737
|
+
it('should detect Opera Mini on Android', function () {
|
738
|
+
expect(parse('Opera/9.80 (Android; Opera Mini/7.0.29952/28.2144; U; en) Presto/2.8.119 Version/11.10'))
|
739
|
+
.toMatchUserAgent({
|
740
|
+
name: 'OperaMini',
|
741
|
+
version: '7.0.29952',
|
742
|
+
platform: 'Android',
|
743
|
+
platformVersion: 'Unknown',
|
744
|
+
engine: 'Presto',
|
745
|
+
engineVersion: '2.8.119',
|
746
|
+
documentMode: undefined,
|
747
|
+
browserInfo: {
|
748
|
+
hasWebFontSupport: false,
|
749
|
+
hasWebKitFallbackBug: false
|
750
|
+
}
|
751
|
+
});
|
752
|
+
});
|
753
|
+
});
|
754
|
+
|
755
|
+
describe('WebKit fallback bug', function () {
|
756
|
+
it('should detect the bug in older browsers', function () {
|
757
|
+
expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5'))
|
758
|
+
.toMatchUserAgent({
|
759
|
+
name: 'Chrome',
|
760
|
+
version: '19.0.1084.9',
|
761
|
+
platform: 'Linux',
|
762
|
+
platformVersion: 'Unknown',
|
763
|
+
engine: 'AppleWebKit',
|
764
|
+
engineVersion: '536.5',
|
765
|
+
documentMode: undefined,
|
766
|
+
browserInfo: {
|
767
|
+
hasWebFontSupport: true,
|
768
|
+
hasWebKitFallbackBug: true
|
769
|
+
}
|
770
|
+
});
|
771
|
+
});
|
772
|
+
|
773
|
+
it('should detect the bug in older browsers', function () {
|
774
|
+
expect(parse('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.814.2 Safari/536.11'))
|
775
|
+
.toMatchUserAgent({
|
776
|
+
name: 'Chrome',
|
777
|
+
version: '20.0.814.2',
|
778
|
+
platform: 'Linux',
|
779
|
+
platformVersion: 'Unknown',
|
780
|
+
engine: 'AppleWebKit',
|
781
|
+
engineVersion: '536.11',
|
782
|
+
documentMode: undefined,
|
783
|
+
browserInfo: {
|
784
|
+
hasWebFontSupport: true,
|
785
|
+
hasWebKitFallbackBug: false
|
786
|
+
}
|
787
|
+
});
|
788
|
+
});
|
789
|
+
});
|
790
|
+
|
791
|
+
describe('Invented user agents', function () {
|
792
|
+
it('should detect Gecko as supporting web fonts', function () {
|
793
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.9.1.4) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
794
|
+
.toMatchUserAgent({
|
795
|
+
name: 'Mozilla',
|
796
|
+
version: 'Unknown',
|
797
|
+
platform: 'Windows',
|
798
|
+
platformVersion: '5.1',
|
799
|
+
engine: 'Gecko',
|
800
|
+
engineVersion: '1.9.1.4',
|
801
|
+
documentMode: undefined,
|
802
|
+
browserInfo: {
|
803
|
+
hasWebFontSupport: true,
|
804
|
+
hasWebKitFallbackBug: false
|
805
|
+
}
|
806
|
+
});
|
807
|
+
});
|
808
|
+
|
809
|
+
it('should detect unknown versions of Gecko as supporting web fonts', function () {
|
810
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:2.5.8) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
811
|
+
.toMatchUserAgent({
|
812
|
+
name: 'Mozilla',
|
813
|
+
version: 'Unknown',
|
814
|
+
platform: 'Windows',
|
815
|
+
platformVersion: '5.1',
|
816
|
+
engine: 'Gecko',
|
817
|
+
engineVersion: '2.5.8',
|
818
|
+
documentMode: undefined,
|
819
|
+
browserInfo: {
|
820
|
+
hasWebFontSupport: true,
|
821
|
+
hasWebKitFallbackBug: false
|
822
|
+
}
|
823
|
+
});
|
824
|
+
});
|
825
|
+
|
826
|
+
it('should detect Gecko v1.10 as supporting web fonts', function () {
|
827
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.10.1b) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
828
|
+
.toMatchUserAgent({
|
829
|
+
name: 'Mozilla',
|
830
|
+
version: 'Unknown',
|
831
|
+
platform: 'Windows',
|
832
|
+
platformVersion: '5.1',
|
833
|
+
engine: 'Gecko',
|
834
|
+
engineVersion: '1.10.1b',
|
835
|
+
documentMode: undefined,
|
836
|
+
browserInfo: {
|
837
|
+
hasWebFontSupport: true,
|
838
|
+
hasWebKitFallbackBug: false
|
839
|
+
}
|
840
|
+
});
|
841
|
+
});
|
842
|
+
|
843
|
+
it('should detect Gecko with an invalid version number as not supporting web fonts', function () {
|
844
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
845
|
+
.toMatchUserAgent({
|
846
|
+
name: 'Mozilla',
|
847
|
+
version: 'Unknown',
|
848
|
+
platform: 'Windows',
|
849
|
+
platformVersion: '5.1',
|
850
|
+
engine: 'Gecko',
|
851
|
+
engineVersion: '1.b',
|
852
|
+
documentMode: undefined,
|
853
|
+
browserInfo: {
|
854
|
+
hasWebFontSupport: false,
|
855
|
+
hasWebKitFallbackBug: false
|
856
|
+
}
|
857
|
+
});
|
858
|
+
|
859
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
860
|
+
.toMatchUserAgent({
|
861
|
+
name: 'Mozilla',
|
862
|
+
version: 'Unknown',
|
863
|
+
platform: 'Windows',
|
864
|
+
platformVersion: '5.1',
|
865
|
+
engine: 'Gecko',
|
866
|
+
engineVersion: '1.b',
|
867
|
+
documentMode: undefined,
|
868
|
+
browserInfo: {
|
869
|
+
hasWebFontSupport: false,
|
870
|
+
hasWebKitFallbackBug: false
|
871
|
+
}
|
872
|
+
});
|
873
|
+
|
874
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.9) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
875
|
+
.toMatchUserAgent({
|
876
|
+
name: 'Mozilla',
|
877
|
+
version: 'Unknown',
|
878
|
+
platform: 'Windows',
|
879
|
+
platformVersion: '5.1',
|
880
|
+
engine: 'Gecko',
|
881
|
+
engineVersion: '1.9',
|
882
|
+
documentMode: undefined,
|
883
|
+
browserInfo: {
|
884
|
+
hasWebFontSupport: false,
|
885
|
+
hasWebKitFallbackBug: false
|
886
|
+
}
|
887
|
+
});
|
888
|
+
|
889
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.10.1) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
890
|
+
.toMatchUserAgent({
|
891
|
+
name: 'Mozilla',
|
892
|
+
version: 'Unknown',
|
893
|
+
platform: 'Windows',
|
894
|
+
platformVersion: '5.1',
|
895
|
+
engine: 'Gecko',
|
896
|
+
engineVersion: '0.10.1',
|
897
|
+
documentMode: undefined,
|
898
|
+
browserInfo: {
|
899
|
+
hasWebFontSupport: false,
|
900
|
+
hasWebKitFallbackBug: false
|
901
|
+
}
|
902
|
+
});
|
903
|
+
|
904
|
+
expect(parse('Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.3.42) Gecko/20091016 (.NET CLR 3.5.30729)'))
|
905
|
+
.toMatchUserAgent({
|
906
|
+
name: 'Mozilla',
|
907
|
+
version: 'Unknown',
|
908
|
+
platform: 'Windows',
|
909
|
+
platformVersion: '5.1',
|
910
|
+
engine: 'Gecko',
|
911
|
+
engineVersion: '0.3.42',
|
912
|
+
documentMode: undefined,
|
913
|
+
browserInfo: {
|
914
|
+
hasWebFontSupport: false,
|
915
|
+
hasWebKitFallbackBug: false
|
916
|
+
}
|
917
|
+
});
|
918
|
+
});
|
919
|
+
});
|
920
|
+
});
|
921
|
+
});
|