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
@@ -1,755 +0,0 @@
|
|
1
|
-
var UserAgentTest = TestCase('UserAgentTest');
|
2
|
-
UserAgentTest.prototype.setUp = function() {
|
3
|
-
this.defaultDocument_ = { };
|
4
|
-
this.ie8Document_ = { documentMode: 8 };
|
5
|
-
};
|
6
|
-
|
7
|
-
UserAgentTest.prototype.testBrowserIsAir = function() {
|
8
|
-
var userAgentParser = new webfont.UserAgentParser(
|
9
|
-
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5",
|
10
|
-
this.defaultDocument_);
|
11
|
-
var userAgent = userAgentParser.parse();
|
12
|
-
|
13
|
-
assertEquals("AdobeAIR", userAgent.getName());
|
14
|
-
assertEquals("2.5", userAgent.getVersion());
|
15
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
16
|
-
assertEquals("Unknown", userAgent.getPlatformVersion());
|
17
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
18
|
-
assertEquals("531.9", userAgent.getEngineVersion());
|
19
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
20
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
21
|
-
};
|
22
|
-
|
23
|
-
UserAgentTest.prototype.testBrowserIsUnsupportedAir = function() {
|
24
|
-
var userAgentParser = new webfont.UserAgentParser(
|
25
|
-
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.0",
|
26
|
-
this.defaultDocument_);
|
27
|
-
var userAgent = userAgentParser.parse();
|
28
|
-
|
29
|
-
assertEquals("AdobeAIR", userAgent.getName());
|
30
|
-
assertEquals("2.0", userAgent.getVersion());
|
31
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
32
|
-
assertEquals("Unknown", userAgent.getPlatformVersion());
|
33
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
34
|
-
assertEquals("531.9", userAgent.getEngineVersion());
|
35
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
36
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
37
|
-
};
|
38
|
-
|
39
|
-
UserAgentTest.prototype.testBrowserIsFirefox = function() {
|
40
|
-
var userAgentParser = new webfont.UserAgentParser(
|
41
|
-
"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",
|
42
|
-
this.defaultDocument_);
|
43
|
-
var userAgent = userAgentParser.parse();
|
44
|
-
|
45
|
-
assertEquals("Firefox", userAgent.getName());
|
46
|
-
assertEquals("3.6.3", userAgent.getVersion());
|
47
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
48
|
-
assertEquals("10.5", userAgent.getPlatformVersion());
|
49
|
-
assertEquals("Gecko", userAgent.getEngine());
|
50
|
-
assertEquals("1.9.2.3", userAgent.getEngineVersion());
|
51
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
52
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
53
|
-
};
|
54
|
-
|
55
|
-
UserAgentTest.prototype.testBrowserIsFirefox4beta = function() {
|
56
|
-
var userAgentParser = new webfont.UserAgentParser(
|
57
|
-
"Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:2.0b1) Gecko/20100630 Firefox/4.0b1",
|
58
|
-
this.defaultDocument_);
|
59
|
-
var userAgent = userAgentParser.parse();
|
60
|
-
|
61
|
-
assertEquals("Firefox", userAgent.getName());
|
62
|
-
assertEquals("4.0b1", userAgent.getVersion());
|
63
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
64
|
-
assertEquals("10.6", userAgent.getPlatformVersion());
|
65
|
-
assertEquals("Gecko", userAgent.getEngine());
|
66
|
-
assertEquals("2.0b1", userAgent.getEngineVersion());
|
67
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
68
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
69
|
-
};
|
70
|
-
|
71
|
-
UserAgentTest.prototype.testBrowserIsChrome = function() {
|
72
|
-
var userAgentParser = new webfont.UserAgentParser(
|
73
|
-
"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",
|
74
|
-
this.defaultDocument_);
|
75
|
-
var userAgent = userAgentParser.parse();
|
76
|
-
|
77
|
-
assertEquals("Chrome", userAgent.getName());
|
78
|
-
assertEquals("5.0.342.9", userAgent.getVersion());
|
79
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
80
|
-
assertEquals("10_5_8", userAgent.getPlatformVersion());
|
81
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
82
|
-
assertEquals("533.2", userAgent.getEngineVersion());
|
83
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
84
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
85
|
-
};
|
86
|
-
|
87
|
-
UserAgentTest.prototype.testBrowserIsChromeOS = function() {
|
88
|
-
var userAgentParser = new webfont.UserAgentParser(
|
89
|
-
"Mozilla/5.0 (X11; CrOS i686 1660.57.0) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.46 Safari/535.19",
|
90
|
-
this.defaultDocument_);
|
91
|
-
var userAgent = userAgentParser.parse();
|
92
|
-
|
93
|
-
assertEquals("Chrome", userAgent.getName());
|
94
|
-
assertEquals("18.0.1025.46", userAgent.getVersion());
|
95
|
-
assertEquals("CrOS", userAgent.getPlatform());
|
96
|
-
assertEquals("i686 1660.57.0", userAgent.getPlatformVersion());
|
97
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
98
|
-
assertEquals("535.19", userAgent.getEngineVersion());
|
99
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
100
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
101
|
-
};
|
102
|
-
|
103
|
-
UserAgentTest.prototype.testBrowserIsSafari = function() {
|
104
|
-
var userAgentParser = new webfont.UserAgentParser(
|
105
|
-
"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",
|
106
|
-
this.defaultDocument_);
|
107
|
-
var userAgent = userAgentParser.parse();
|
108
|
-
|
109
|
-
assertEquals("Safari", userAgent.getName());
|
110
|
-
assertEquals("4.0.4", userAgent.getVersion());
|
111
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
112
|
-
assertEquals("10_5_8", userAgent.getPlatformVersion());
|
113
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
114
|
-
assertEquals("531.21.8", userAgent.getEngineVersion());
|
115
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
116
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
117
|
-
};
|
118
|
-
|
119
|
-
UserAgentTest.prototype.testBrowserIsIE = function() {
|
120
|
-
var userAgentParser = new webfont.UserAgentParser(
|
121
|
-
"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)",
|
122
|
-
this.defaultDocument_);
|
123
|
-
var userAgent = userAgentParser.parse();
|
124
|
-
|
125
|
-
assertEquals("MSIE", userAgent.getName());
|
126
|
-
assertEquals("7.0", userAgent.getVersion());
|
127
|
-
assertEquals("Windows", userAgent.getPlatform());
|
128
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
129
|
-
assertEquals("MSIE", userAgent.getEngine());
|
130
|
-
assertEquals("7.0", userAgent.getEngineVersion());
|
131
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
132
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
133
|
-
};
|
134
|
-
|
135
|
-
UserAgentTest.prototype.testBrowserIsIEMinimal = function() {
|
136
|
-
var userAgentParser = new webfont.UserAgentParser(
|
137
|
-
"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)",
|
138
|
-
this.defaultDocument_);
|
139
|
-
var userAgent = userAgentParser.parse();
|
140
|
-
|
141
|
-
assertEquals("MSIE", userAgent.getName());
|
142
|
-
assertEquals("7.0", userAgent.getVersion());
|
143
|
-
assertEquals("Windows", userAgent.getPlatform());
|
144
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
145
|
-
assertEquals("MSIE", userAgent.getEngine());
|
146
|
-
assertEquals("7.0", userAgent.getEngineVersion());
|
147
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
148
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
149
|
-
};
|
150
|
-
|
151
|
-
UserAgentTest.prototype.testBrowserIsIEOnWindowsPhone = function() {
|
152
|
-
var userAgentParser = new webfont.UserAgentParser(
|
153
|
-
"Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; ARM; Touch; IEMobile/10.0; <Manufacturer>; <Device>; <Operator>)",
|
154
|
-
this.defaultDocument_);
|
155
|
-
var userAgent = userAgentParser.parse();
|
156
|
-
|
157
|
-
assertEquals("MSIE", userAgent.getName());
|
158
|
-
assertEquals("10.0", userAgent.getVersion());
|
159
|
-
assertEquals("Windows Phone", userAgent.getPlatform());
|
160
|
-
assertEquals("8.0", userAgent.getPlatformVersion());
|
161
|
-
assertEquals("MSIE", userAgent.getEngine());
|
162
|
-
assertEquals("10.0", userAgent.getEngineVersion());
|
163
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
164
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
165
|
-
};
|
166
|
-
|
167
|
-
UserAgentTest.prototype.testBrowserIsIEOnOldWindowsPhone = function() {
|
168
|
-
var userAgentParser = new webfont.UserAgentParser(
|
169
|
-
"Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; SAMSUNG; SGH-i917)",
|
170
|
-
this.defaultDocument_);
|
171
|
-
var userAgent = userAgentParser.parse();
|
172
|
-
|
173
|
-
assertEquals("MSIE", userAgent.getName());
|
174
|
-
assertEquals("9.0", userAgent.getVersion());
|
175
|
-
assertEquals("Windows Phone", userAgent.getPlatform());
|
176
|
-
assertEquals("7.5", userAgent.getPlatformVersion());
|
177
|
-
assertEquals("MSIE", userAgent.getEngine());
|
178
|
-
assertEquals("9.0", userAgent.getEngineVersion());
|
179
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
180
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
181
|
-
};
|
182
|
-
|
183
|
-
UserAgentTest.prototype.testBrowserIsIPhone = function() {
|
184
|
-
var userAgentParser = new webfont.UserAgentParser(
|
185
|
-
"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",
|
186
|
-
this.defaultDocument_);
|
187
|
-
var userAgent = userAgentParser.parse();
|
188
|
-
|
189
|
-
assertEquals("Safari", userAgent.getName());
|
190
|
-
assertEquals("4.0", userAgent.getVersion());
|
191
|
-
assertEquals("iPhone", userAgent.getPlatform());
|
192
|
-
assertEquals("3_1_2", userAgent.getPlatformVersion());
|
193
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
194
|
-
assertEquals("528.18", userAgent.getEngineVersion());
|
195
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
196
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
197
|
-
};
|
198
|
-
|
199
|
-
UserAgentTest.prototype.testBrowserIsAndroid = function() {
|
200
|
-
var userAgentParser = new webfont.UserAgentParser(
|
201
|
-
"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",
|
202
|
-
this.defaultDocument_);
|
203
|
-
var userAgent = userAgentParser.parse();
|
204
|
-
|
205
|
-
assertEquals("BuiltinBrowser", userAgent.getName());
|
206
|
-
assertEquals("Unknown", userAgent.getVersion());
|
207
|
-
assertEquals("Android", userAgent.getPlatform());
|
208
|
-
assertEquals("2.2.1", userAgent.getPlatformVersion());
|
209
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
210
|
-
assertEquals("533.1", userAgent.getEngineVersion());
|
211
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
212
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
213
|
-
};
|
214
|
-
|
215
|
-
UserAgentTest.prototype.testBrowserIsOldUnsupportedAndroid = function() {
|
216
|
-
var userAgentParser = new webfont.UserAgentParser(
|
217
|
-
"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",
|
218
|
-
this.defaultDocument_);
|
219
|
-
var userAgent = userAgentParser.parse();
|
220
|
-
|
221
|
-
assertEquals("BuiltinBrowser", userAgent.getName());
|
222
|
-
assertEquals("Unknown", userAgent.getVersion());
|
223
|
-
assertEquals("Android", userAgent.getPlatform());
|
224
|
-
assertEquals("2.1-update1", userAgent.getPlatformVersion());
|
225
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
226
|
-
assertEquals("530.17", userAgent.getEngineVersion());
|
227
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
228
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
229
|
-
};
|
230
|
-
|
231
|
-
UserAgentTest.prototype.testBrowserIsAndroidChromeMobile = function() {
|
232
|
-
var userAgentParser = new webfont.UserAgentParser(
|
233
|
-
"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",
|
234
|
-
this.defaultDocument_);
|
235
|
-
var userAgent = userAgentParser.parse();
|
236
|
-
|
237
|
-
assertEquals("Chrome", userAgent.getName());
|
238
|
-
assertEquals("16.0.912.75", userAgent.getVersion());
|
239
|
-
assertEquals("Android", userAgent.getPlatform());
|
240
|
-
assertEquals("4.0.3", userAgent.getPlatformVersion());
|
241
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
242
|
-
assertEquals("535.7", userAgent.getEngineVersion());
|
243
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
244
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
245
|
-
};
|
246
|
-
|
247
|
-
UserAgentTest.prototype.testBrowserIsAndroidFirefox = function() {
|
248
|
-
// This useragent has been slightly doctored with versions to ensure the right
|
249
|
-
// info is coming from the right places.
|
250
|
-
var userAgentParser = new webfont.UserAgentParser(
|
251
|
-
"Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/15.0 Firefox/14.0",
|
252
|
-
this.defaultDocument_);
|
253
|
-
var userAgent = userAgentParser.parse();
|
254
|
-
|
255
|
-
assertEquals("Firefox", userAgent.getName());
|
256
|
-
assertEquals("14.0", userAgent.getVersion());
|
257
|
-
assertEquals("Android", userAgent.getPlatform());
|
258
|
-
assertEquals("Unknown", userAgent.getPlatformVersion());
|
259
|
-
assertEquals("Gecko", userAgent.getEngine());
|
260
|
-
assertEquals("13.0", userAgent.getEngineVersion());
|
261
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
262
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
263
|
-
}
|
264
|
-
|
265
|
-
UserAgentTest.prototype.testBrowserIsFirefoxLettersVersion = function() {
|
266
|
-
var userAgentParser = new webfont.UserAgentParser(
|
267
|
-
"Mozilla/5.0 (X11; U; Linux i686; ru-RU; rv:1.9.2a1pre) Gecko/20090405 Ubuntu/9.04 (jaunty) Firefox/3.6a1pre",
|
268
|
-
this.defaultDocument_);
|
269
|
-
var userAgent = userAgentParser.parse();
|
270
|
-
|
271
|
-
assertEquals("Firefox", userAgent.getName());
|
272
|
-
assertEquals("3.6a1pre", userAgent.getVersion());
|
273
|
-
assertEquals("Linux", userAgent.getPlatform());
|
274
|
-
assertEquals("i686", userAgent.getPlatformVersion());
|
275
|
-
assertEquals("Gecko", userAgent.getEngine());
|
276
|
-
assertEquals("1.9.2a1pre", userAgent.getEngineVersion());
|
277
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
278
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
279
|
-
};
|
280
|
-
|
281
|
-
UserAgentTest.prototype.testBrowserIsFirefoxNoVersion = function() {
|
282
|
-
var userAgentParser = new webfont.UserAgentParser(
|
283
|
-
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081202 Firefox (Debian-2.0.0.19-0etch1)",
|
284
|
-
this.defaultDocument_);
|
285
|
-
var userAgent = userAgentParser.parse();
|
286
|
-
|
287
|
-
assertEquals("Firefox", userAgent.getName());
|
288
|
-
assertEquals("Unknown", userAgent.getVersion());
|
289
|
-
assertEquals("Linux", userAgent.getPlatform());
|
290
|
-
assertEquals("i686", userAgent.getPlatformVersion());
|
291
|
-
assertEquals("Gecko", userAgent.getEngine());
|
292
|
-
assertEquals("1.8.1.19", userAgent.getEngineVersion());
|
293
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
294
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
295
|
-
};
|
296
|
-
|
297
|
-
UserAgentTest.prototype.testBrowserIsIELetterVersion = function() {
|
298
|
-
var userAgentParser = new webfont.UserAgentParser(
|
299
|
-
"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)",
|
300
|
-
this.defaultDocument_);
|
301
|
-
var userAgent = userAgentParser.parse();
|
302
|
-
|
303
|
-
assertEquals("MSIE", userAgent.getName());
|
304
|
-
assertEquals("7.0b", userAgent.getVersion());
|
305
|
-
assertEquals("Windows", userAgent.getPlatform());
|
306
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
307
|
-
assertEquals("MSIE", userAgent.getEngine());
|
308
|
-
assertEquals("7.0b", userAgent.getEngineVersion());
|
309
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
310
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
311
|
-
};
|
312
|
-
|
313
|
-
UserAgentTest.prototype.testBrowserIsOpera = function() {
|
314
|
-
var userAgentParser = new webfont.UserAgentParser(
|
315
|
-
"Opera/9.80 (Linux i686; U; en) Presto/2.5.22 Version/10.51",
|
316
|
-
this.defaultDocument_);
|
317
|
-
var userAgent = userAgentParser.parse();
|
318
|
-
|
319
|
-
assertEquals("Opera", userAgent.getName());
|
320
|
-
assertEquals("10.51", userAgent.getVersion());
|
321
|
-
assertEquals("Linux", userAgent.getPlatform());
|
322
|
-
assertEquals("i686", userAgent.getPlatformVersion());
|
323
|
-
assertEquals("Presto", userAgent.getEngine());
|
324
|
-
assertEquals("2.5.22", userAgent.getEngineVersion());
|
325
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
326
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
327
|
-
};
|
328
|
-
|
329
|
-
UserAgentTest.prototype.testBrowserIsOperaFirefoxInUAString = function() {
|
330
|
-
var userAgentParser = new webfont.UserAgentParser(
|
331
|
-
"Mozilla/5.0 (Linux i686 ; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 9.70",
|
332
|
-
this.defaultDocument_);
|
333
|
-
var userAgent = userAgentParser.parse();
|
334
|
-
|
335
|
-
assertEquals("Opera", userAgent.getName());
|
336
|
-
assertEquals("9.70", userAgent.getVersion());
|
337
|
-
assertEquals("Linux", userAgent.getPlatform());
|
338
|
-
assertEquals("i686", userAgent.getPlatformVersion());
|
339
|
-
assertEquals("Gecko", userAgent.getEngine());
|
340
|
-
assertEquals("1.8.1", userAgent.getEngineVersion());
|
341
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
342
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
343
|
-
};
|
344
|
-
|
345
|
-
UserAgentTest.prototype.testBrowserIsOperaBeforeVersion10 = function() {
|
346
|
-
var userAgentParser = new webfont.UserAgentParser(
|
347
|
-
"Opera/9.64 (X11; Linux i686; U; Linux Mint; nb) Presto/2.1.1",
|
348
|
-
this.defaultDocument_);
|
349
|
-
var userAgent = userAgentParser.parse();
|
350
|
-
|
351
|
-
assertEquals("Opera", userAgent.getName());
|
352
|
-
assertEquals("9.64", userAgent.getVersion());
|
353
|
-
assertEquals("Linux", userAgent.getPlatform());
|
354
|
-
assertEquals("i686", userAgent.getPlatformVersion());
|
355
|
-
assertEquals("Presto", userAgent.getEngine());
|
356
|
-
assertEquals("2.1.1", userAgent.getEngineVersion());
|
357
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
358
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
359
|
-
};
|
360
|
-
|
361
|
-
UserAgentTest.prototype.testBrowserIsOperaMobileAndroid = function() {
|
362
|
-
// For the purposes of web font support, we consider Opera Mobile to be a
|
363
|
-
// version of full Opera on mobile devices, since the support for web fonts
|
364
|
-
// follows the same version numbers as the desktop versions.
|
365
|
-
var userAgentParser = new webfont.UserAgentParser(
|
366
|
-
"Opera/9.80 (Android 4.1.1; Linux; Opera Mobi/ADR-1207201819; U; en) Presto/2.10.254 Version/12.00",
|
367
|
-
this.defaultDocument_);
|
368
|
-
var userAgent = userAgentParser.parse();
|
369
|
-
|
370
|
-
assertEquals("Opera", userAgent.getName());
|
371
|
-
assertEquals("12.00", userAgent.getVersion());
|
372
|
-
assertEquals("Android", userAgent.getPlatform());
|
373
|
-
assertEquals("4.1.1", userAgent.getPlatformVersion());
|
374
|
-
assertEquals("Presto", userAgent.getEngine());
|
375
|
-
assertEquals("2.10.254", userAgent.getEngineVersion());
|
376
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
377
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
378
|
-
};
|
379
|
-
|
380
|
-
UserAgentTest.prototype.testBrowserIsOperaMiniAndroid = function() {
|
381
|
-
// For the purposes of web font support, we consider Opera Mini to be a
|
382
|
-
// different browser from the full Opera, since it doesn't support web fonts
|
383
|
-
// and follows two separate versioning systems. We use the Opera Mini version
|
384
|
-
// instead of the more generic Opera version.
|
385
|
-
var userAgentParser = new webfont.UserAgentParser(
|
386
|
-
"Opera/9.80 (Android; Opera Mini/7.0.29952/28.2144; U; en) Presto/2.8.119 Version/11.10",
|
387
|
-
this.defaultDocument_);
|
388
|
-
var userAgent = userAgentParser.parse();
|
389
|
-
|
390
|
-
assertEquals("OperaMini", userAgent.getName());
|
391
|
-
assertEquals("7.0.29952", userAgent.getVersion());
|
392
|
-
assertEquals("Android", userAgent.getPlatform());
|
393
|
-
assertEquals("Unknown", userAgent.getPlatformVersion());
|
394
|
-
assertEquals("Presto", userAgent.getEngine());
|
395
|
-
assertEquals("2.8.119", userAgent.getEngineVersion());
|
396
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
397
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
398
|
-
}
|
399
|
-
|
400
|
-
UserAgentTest.prototype.testBrowserIsIEOnMac = function() {
|
401
|
-
var userAgentParser = new webfont.UserAgentParser(
|
402
|
-
"Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)",
|
403
|
-
this.defaultDocument_);
|
404
|
-
var userAgent = userAgentParser.parse();
|
405
|
-
|
406
|
-
assertEquals("MSIE", userAgent.getName());
|
407
|
-
assertEquals("5.23", userAgent.getVersion());
|
408
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
409
|
-
assertEquals("Unknown", userAgent.getPlatformVersion());
|
410
|
-
assertEquals("MSIE", userAgent.getEngine());
|
411
|
-
assertEquals("5.23", userAgent.getEngineVersion());
|
412
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
413
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
414
|
-
};
|
415
|
-
|
416
|
-
UserAgentTest.prototype.testBrowserIsIPad = function() {
|
417
|
-
var userAgentParser = new webfont.UserAgentParser(
|
418
|
-
"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",
|
419
|
-
this.defaultDocument_);
|
420
|
-
var userAgent = userAgentParser.parse();
|
421
|
-
|
422
|
-
assertEquals("Safari", userAgent.getName());
|
423
|
-
assertEquals("4.0.4", userAgent.getVersion());
|
424
|
-
assertEquals("iPad", userAgent.getPlatform());
|
425
|
-
assertEquals("3_2", userAgent.getPlatformVersion());
|
426
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
427
|
-
assertEquals("531.21.10", userAgent.getEngineVersion());
|
428
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
429
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
430
|
-
};
|
431
|
-
|
432
|
-
UserAgentTest.prototype.testBrowserIsIPadAlt = function() {
|
433
|
-
var userAgentParser = new webfont.UserAgentParser(
|
434
|
-
"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",
|
435
|
-
this.defaultDocument_);
|
436
|
-
var userAgent = userAgentParser.parse();
|
437
|
-
|
438
|
-
assertEquals("Safari", userAgent.getName());
|
439
|
-
assertEquals("4.0.4", userAgent.getVersion());
|
440
|
-
assertEquals("iPad", userAgent.getPlatform());
|
441
|
-
assertEquals("3_2", userAgent.getPlatformVersion());
|
442
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
443
|
-
assertEquals("531.21.10", userAgent.getEngineVersion());
|
444
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
445
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
446
|
-
};
|
447
|
-
|
448
|
-
UserAgentTest.prototype.testBrowserIsIPadWithoutIPhone = function() {
|
449
|
-
var userAgentParser = new webfont.UserAgentParser(
|
450
|
-
"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",
|
451
|
-
this.defaultDocument_);
|
452
|
-
var userAgent = userAgentParser.parse();
|
453
|
-
|
454
|
-
assertEquals("Safari", userAgent.getName());
|
455
|
-
assertEquals("4.0.4", userAgent.getVersion());
|
456
|
-
assertEquals("iPad", userAgent.getPlatform());
|
457
|
-
assertEquals("3_2", userAgent.getPlatformVersion());
|
458
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
459
|
-
assertEquals("531.21.10", userAgent.getEngineVersion());
|
460
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
461
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
462
|
-
};
|
463
|
-
|
464
|
-
UserAgentTest.prototype.testBrowserIsIPadChrome = function() {
|
465
|
-
var userAgentParser = new webfont.UserAgentParser(
|
466
|
-
"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",
|
467
|
-
this.defaultDocument_);
|
468
|
-
var userAgent = userAgentParser.parse();
|
469
|
-
|
470
|
-
assertEquals("Chrome", userAgent.getName());
|
471
|
-
assertEquals("19.0.1084.60", userAgent.getVersion());
|
472
|
-
assertEquals("iPad", userAgent.getPlatform());
|
473
|
-
assertEquals("5_1_1", userAgent.getPlatformVersion());
|
474
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
475
|
-
assertEquals("534.46.0", userAgent.getEngineVersion());
|
476
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
477
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
478
|
-
}
|
479
|
-
|
480
|
-
UserAgentTest.prototype.testBrowserIsIPod = function() {
|
481
|
-
var userAgentParser = new webfont.UserAgentParser(
|
482
|
-
"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",
|
483
|
-
this.defaultDocument_);
|
484
|
-
var userAgent = userAgentParser.parse();
|
485
|
-
|
486
|
-
assertEquals("Unknown", userAgent.getName());
|
487
|
-
assertEquals("Unknown", userAgent.getVersion());
|
488
|
-
assertEquals("iPod", userAgent.getPlatform());
|
489
|
-
assertEquals("2_2_1", userAgent.getPlatformVersion());
|
490
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
491
|
-
assertEquals("525.18.1", userAgent.getEngineVersion());
|
492
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
493
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
494
|
-
};
|
495
|
-
|
496
|
-
UserAgentTest.prototype.testBrowserIsIPodSafari = function() {
|
497
|
-
var userAgentParser = new webfont.UserAgentParser(
|
498
|
-
"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",
|
499
|
-
this.defaultDocument_);
|
500
|
-
var userAgent = userAgentParser.parse();
|
501
|
-
|
502
|
-
assertEquals("Safari", userAgent.getName());
|
503
|
-
assertEquals("4.0", userAgent.getVersion());
|
504
|
-
assertEquals("iPod", userAgent.getPlatform());
|
505
|
-
assertEquals("3_1", userAgent.getPlatformVersion());
|
506
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
507
|
-
assertEquals("528.18", userAgent.getEngineVersion());
|
508
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
509
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
510
|
-
};
|
511
|
-
|
512
|
-
UserAgentTest.prototype.testBrowserIsIPodChrome = function() {
|
513
|
-
var userAgentParser = new webfont.UserAgentParser(
|
514
|
-
"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",
|
515
|
-
this.defaultDocument_);
|
516
|
-
var userAgent = userAgentParser.parse();
|
517
|
-
|
518
|
-
assertEquals("Chrome", userAgent.getName());
|
519
|
-
assertEquals("19.0.1084.60", userAgent.getVersion());
|
520
|
-
assertEquals("iPod", userAgent.getPlatform());
|
521
|
-
assertEquals("5_1_1", userAgent.getPlatformVersion());
|
522
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
523
|
-
assertEquals("534.46.0", userAgent.getEngineVersion());
|
524
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
525
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
526
|
-
}
|
527
|
-
|
528
|
-
UserAgentTest.prototype.testBrowserIsSafariWithPlusVersion = function() {
|
529
|
-
var userAgentParser = new webfont.UserAgentParser(
|
530
|
-
"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",
|
531
|
-
this.defaultDocument_);
|
532
|
-
var userAgent = userAgentParser.parse();
|
533
|
-
|
534
|
-
assertEquals("Safari", userAgent.getName());
|
535
|
-
assertEquals("4.0dp1", userAgent.getVersion());
|
536
|
-
assertEquals("Macintosh", userAgent.getPlatform());
|
537
|
-
assertEquals("10_4_11", userAgent.getPlatformVersion());
|
538
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
539
|
-
assertEquals("528.4+", userAgent.getEngineVersion());
|
540
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
541
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
542
|
-
};
|
543
|
-
|
544
|
-
UserAgentTest.prototype.testBrowserIsIEWithTridentVersion = function() {
|
545
|
-
var userAgentParser = new webfont.UserAgentParser(
|
546
|
-
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; InfoPath.2)",
|
547
|
-
this.ie8Document_);
|
548
|
-
var userAgent = userAgentParser.parse();
|
549
|
-
|
550
|
-
assertEquals("MSIE", userAgent.getName());
|
551
|
-
assertEquals("8.0", userAgent.getVersion());
|
552
|
-
assertEquals("Windows", userAgent.getPlatform());
|
553
|
-
assertEquals("6.1", userAgent.getPlatformVersion());
|
554
|
-
assertEquals("MSIE", userAgent.getEngine());
|
555
|
-
assertEquals("8.0", userAgent.getEngineVersion());
|
556
|
-
assertEquals(8, userAgent.getDocumentMode());
|
557
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
558
|
-
};
|
559
|
-
|
560
|
-
// Invented user agent strings
|
561
|
-
|
562
|
-
UserAgentTest.prototype.testBrowserGeckoShouldSupportWebFont = function() {
|
563
|
-
var userAgentParser = new webfont.UserAgentParser(
|
564
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.9.1.4) Gecko/20091016 (.NET CLR 3.5.30729)",
|
565
|
-
this.defaultDocument_);
|
566
|
-
var userAgent = userAgentParser.parse();
|
567
|
-
|
568
|
-
assertEquals("Mozilla", userAgent.getName());
|
569
|
-
assertEquals("Unknown", userAgent.getVersion());
|
570
|
-
assertEquals("Windows", userAgent.getPlatform());
|
571
|
-
assertEquals("Gecko", userAgent.getEngine());
|
572
|
-
assertEquals("1.9.1.4", userAgent.getEngineVersion());
|
573
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
574
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
575
|
-
};
|
576
|
-
|
577
|
-
UserAgentTest.prototype.testBrowserGeckoNotExistingVersionShouldSupportWebFont = function() {
|
578
|
-
var userAgentParser = new webfont.UserAgentParser(
|
579
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:2.5.8) Gecko/20091016 (.NET CLR 3.5.30729)",
|
580
|
-
this.defaultDocument_);
|
581
|
-
var userAgent = userAgentParser.parse();
|
582
|
-
|
583
|
-
assertEquals("Mozilla", userAgent.getName());
|
584
|
-
assertEquals("Unknown", userAgent.getVersion());
|
585
|
-
assertEquals("Windows", userAgent.getPlatform());
|
586
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
587
|
-
assertEquals("Gecko", userAgent.getEngine());
|
588
|
-
assertEquals("2.5.8", userAgent.getEngineVersion());
|
589
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
590
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
591
|
-
};
|
592
|
-
|
593
|
-
UserAgentTest.prototype.testBrowserGeckoVer110ShouldSupportWebFont = function() {
|
594
|
-
var userAgentParser = new webfont.UserAgentParser(
|
595
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.10.1b) Gecko/20091016 (.NET CLR 3.5.30729)",
|
596
|
-
this.defaultDocument_);
|
597
|
-
var userAgent = userAgentParser.parse();
|
598
|
-
|
599
|
-
assertEquals("Mozilla", userAgent.getName());
|
600
|
-
assertEquals("Unknown", userAgent.getVersion());
|
601
|
-
assertEquals("Windows", userAgent.getPlatform());
|
602
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
603
|
-
assertEquals("Gecko", userAgent.getEngine());
|
604
|
-
assertEquals("1.10.1b", userAgent.getEngineVersion());
|
605
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
606
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
607
|
-
};
|
608
|
-
|
609
|
-
UserAgentTest.prototype.testBrowserGeckoWeirdVerShouldNotSupportWebFont = function() {
|
610
|
-
var userAgentParser = new webfont.UserAgentParser(
|
611
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)",
|
612
|
-
this.defaultDocument_);
|
613
|
-
var userAgent = userAgentParser.parse();
|
614
|
-
|
615
|
-
assertEquals("Mozilla", userAgent.getName());
|
616
|
-
assertEquals("Unknown", userAgent.getVersion());
|
617
|
-
assertEquals("Windows", userAgent.getPlatform());
|
618
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
619
|
-
assertEquals("Gecko", userAgent.getEngine());
|
620
|
-
assertEquals("1.b", userAgent.getEngineVersion());
|
621
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
622
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
623
|
-
};
|
624
|
-
|
625
|
-
UserAgentTest.prototype.testBrowserGeckoYetAnotherWeirdVerShouldNotSupportWebFont = function() {
|
626
|
-
var userAgentParser = new webfont.UserAgentParser(
|
627
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.b) Gecko/20091016 (.NET CLR 3.5.30729)",
|
628
|
-
this.defaultDocument_);
|
629
|
-
var userAgent = userAgentParser.parse();
|
630
|
-
|
631
|
-
assertEquals("Mozilla", userAgent.getName());
|
632
|
-
assertEquals("Unknown", userAgent.getVersion());
|
633
|
-
assertEquals("Windows", userAgent.getPlatform());
|
634
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
635
|
-
assertEquals("Gecko", userAgent.getEngine());
|
636
|
-
assertEquals("1.b", userAgent.getEngineVersion());
|
637
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
638
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
639
|
-
};
|
640
|
-
|
641
|
-
UserAgentTest.prototype.testBrowserGeckoNoSubVerShouldNotSupportWebFont = function() {
|
642
|
-
var userAgentParser = new webfont.UserAgentParser(
|
643
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:1.9) Gecko/20091016 (.NET CLR 3.5.30729)",
|
644
|
-
this.defaultDocument_);
|
645
|
-
var userAgent = userAgentParser.parse();
|
646
|
-
|
647
|
-
assertEquals("Mozilla", userAgent.getName());
|
648
|
-
assertEquals("Unknown", userAgent.getVersion());
|
649
|
-
assertEquals("Windows", userAgent.getPlatform());
|
650
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
651
|
-
assertEquals("Gecko", userAgent.getEngine());
|
652
|
-
assertEquals("1.9", userAgent.getEngineVersion());
|
653
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
654
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
655
|
-
};
|
656
|
-
|
657
|
-
UserAgentTest.prototype.testBrowserGeckoHighMinorVerShouldNotSupportWebFont = function() {
|
658
|
-
var userAgentParser = new webfont.UserAgentParser(
|
659
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.10.1) Gecko/20091016 (.NET CLR 3.5.30729)",
|
660
|
-
this.defaultDocument_);
|
661
|
-
var userAgent = userAgentParser.parse();
|
662
|
-
|
663
|
-
assertEquals("Mozilla", userAgent.getName());
|
664
|
-
assertEquals("Unknown", userAgent.getVersion());
|
665
|
-
assertEquals("Windows", userAgent.getPlatform());
|
666
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
667
|
-
assertEquals("Gecko", userAgent.getEngine());
|
668
|
-
assertEquals("0.10.1", userAgent.getEngineVersion());
|
669
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
670
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
671
|
-
};
|
672
|
-
|
673
|
-
UserAgentTest.prototype.testBrowserGeckoHighSubVerShouldNotSupportWebFont = function() {
|
674
|
-
var userAgentParser = new webfont.UserAgentParser(
|
675
|
-
"Mozilla/5.0 (Windows; U; Windows NT 5.1; ru-RU; rv:0.3.42) Gecko/20091016 (.NET CLR 3.5.30729)",
|
676
|
-
this.defaultDocument_);
|
677
|
-
var userAgent = userAgentParser.parse();
|
678
|
-
|
679
|
-
assertEquals("Mozilla", userAgent.getName());
|
680
|
-
assertEquals("Unknown", userAgent.getVersion());
|
681
|
-
assertEquals("Windows", userAgent.getPlatform());
|
682
|
-
assertEquals("5.1", userAgent.getPlatformVersion());
|
683
|
-
assertEquals("Gecko", userAgent.getEngine());
|
684
|
-
assertEquals("0.3.42", userAgent.getEngineVersion());
|
685
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
686
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
687
|
-
};
|
688
|
-
|
689
|
-
UserAgentTest.prototype.testBrowserBBSupportWebfont = function() {
|
690
|
-
var userAgentParser = new webfont.UserAgentParser(
|
691
|
-
"Mozilla/5.0 (BB10; Touch) AppleWebKit/537.3+ (KHTML, like Gecko) Version/10.0.9.388 Mobile Safari/537.3+",
|
692
|
-
this.defaultDocument_);
|
693
|
-
var userAgent = userAgentParser.parse();
|
694
|
-
|
695
|
-
assertEquals("BuiltinBrowser", userAgent.getName());
|
696
|
-
assertEquals("Unknown", userAgent.getVersion());
|
697
|
-
assertEquals("BlackBerry", userAgent.getPlatform());
|
698
|
-
assertEquals("10.0.9.388", userAgent.getPlatformVersion());
|
699
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
700
|
-
assertEquals("537.3+", userAgent.getEngineVersion());
|
701
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
702
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
703
|
-
};
|
704
|
-
|
705
|
-
UserAgentTest.prototype.testBrowserBBNotSupportWebfont = function() {
|
706
|
-
var userAgentParser = new webfont.UserAgentParser(
|
707
|
-
"Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+",
|
708
|
-
this.defaultDocument_);
|
709
|
-
var userAgent = userAgentParser.parse();
|
710
|
-
|
711
|
-
assertEquals("BuiltinBrowser", userAgent.getName());
|
712
|
-
assertEquals("Unknown", userAgent.getVersion());
|
713
|
-
assertEquals("BlackBerry", userAgent.getPlatform());
|
714
|
-
assertEquals("7.1.0.346", userAgent.getPlatformVersion());
|
715
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
716
|
-
assertEquals("534.11+", userAgent.getEngineVersion());
|
717
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
718
|
-
assertFalse(userAgent.getBrowserInfo().hasWebFontSupport());
|
719
|
-
};
|
720
|
-
|
721
|
-
UserAgentTest.prototype.testBrowserWebKitFallbackBug = function() {
|
722
|
-
var userAgentParser = new webfont.UserAgentParser(
|
723
|
-
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.9 Safari/536.5",
|
724
|
-
this.defaultDocument_);
|
725
|
-
|
726
|
-
var userAgent = userAgentParser.parse();
|
727
|
-
|
728
|
-
assertTrue(userAgent.getBrowserInfo().hasWebKitFallbackBug());
|
729
|
-
};
|
730
|
-
|
731
|
-
UserAgentTest.prototype.testBrowserWebKitNoFallbackBug = function() {
|
732
|
-
var userAgentParser = new webfont.UserAgentParser(
|
733
|
-
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.814.2 Safari/536.11",
|
734
|
-
this.defaultDocument_);
|
735
|
-
|
736
|
-
var userAgent = userAgentParser.parse();
|
737
|
-
|
738
|
-
assertFalse(userAgent.getBrowserInfo().hasWebKitFallbackBug());
|
739
|
-
};
|
740
|
-
|
741
|
-
UserAgentTest.prototype.testBrowserWebKitVSWebkit = function() {
|
742
|
-
var userAgentParser = new webfont.UserAgentParser(
|
743
|
-
"Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML like Gecko) Version/4.0 Mobile Safari/534.30",
|
744
|
-
this.defaultDocument_);
|
745
|
-
var userAgent = userAgentParser.parse();
|
746
|
-
|
747
|
-
assertEquals("BuiltinBrowser", userAgent.getName());
|
748
|
-
assertEquals("Unknown", userAgent.getVersion());
|
749
|
-
assertEquals("Android", userAgent.getPlatform());
|
750
|
-
assertEquals("4.0.3", userAgent.getPlatformVersion());
|
751
|
-
assertEquals("AppleWebKit", userAgent.getEngine());
|
752
|
-
assertEquals("534.30", userAgent.getEngineVersion());
|
753
|
-
assertEquals(undefined, userAgent.getDocumentMode());
|
754
|
-
assertTrue(userAgent.getBrowserInfo().hasWebFontSupport());
|
755
|
-
};
|