3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
15 describe("Ext.Browser and Ext.OS", function() {
19 userAgent: 'Safari_5533.18.5Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 Safari/533.18.5',
23 flags: ['Safari', 'Safari5', 'Safari502', 'WebKit', 'WebKit533', 'WebKit533181'],
36 userAgent: 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7',
40 flags: ['Chrome', 'Chrome7', 'Chrome7051744', 'WebKit', 'WebKit5347', 'WebKit534'],
53 userAgent: 'Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.6.30 Version/10.63',
57 flags: ['Opera', 'Opera9', 'Opera980', 'Presto', 'Presto2630', 'Presto2'],
70 userAgent: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; .NET CLR 3.5.30729)',
74 flags: ['IE', 'IE8', 'IE80', 'Trident', 'Trident4', 'Trident40'],
87 userAgent: 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)',
91 flags: ['IE', 'IE7', 'IE70', 'Other'],
104 userAgent: 'Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)',
108 flags: ['IE', 'IE6', 'IE61', 'Other'],
121 userAgent: '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',
125 flags: ['Safari', 'Safari4', 'Safari404', 'WebKit', 'WebKit531', 'WebKit5312110'],
130 flags: ['iOS', 'iOS3', 'iOS32', 'iPad'],
138 userAgent: 'Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16',
142 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit528', 'WebKit52818'],
147 flags: ['iOS', 'iOS3', 'iOS313', 'iPhone'],
155 userAgent: 'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B118 Safari/6531.22.7',
159 flags: ['Safari', 'Safari4', 'Safari405', 'WebKit', 'WebKit532', 'WebKit5329'],
164 flags: ['iOS', 'iOS4', 'iOS41', 'iPod'],
172 userAgent: 'Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16',
176 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit528', 'WebKit52818'],
181 flags: ['iOS', 'iOS3', 'iOS313', 'iPod'],
188 platform: 'Linux armv7l',
189 userAgent: ' Mozilla/5.0 (Linux; U; Android 2.2; en-us; T-Mobile G2 Build/ FRF91) AppleWebKit/533.1(KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
193 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit533', 'WebKit5331'],
198 flags: ['Android', 'Android2', 'Android22'],
205 platform: 'Linux armv7l',
206 userAgent: 'Mozilla/5.0 (Linux; U; Android 2.2; en-vn; Desire_A8181 Build/FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
210 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit533', 'WebKit5331'],
215 flags: ['Android', 'Android2', 'Android22'],
221 Android_22_NexusOne: {
222 platform: 'Linux armv7l',
223 userAgent: 'Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/ FRF91) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1',
227 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit533', 'WebKit5331'],
232 flags: ['Android', 'Android2', 'Android22'],
238 Android_21_GalaxyS: {
239 platform: 'Linux armv7l',
240 userAgent: 'Mozilla/5.0 (Linux; U; Android 2.1-update1; fr-fr; GT-I9000 Build/ECLAIR) AppleWebKit/530.17 (KHTML, like Gecko) Version/4.0 Mobile Safari/530.17',
244 flags: ['Safari', 'Safari4', 'Safari40', 'WebKit', 'WebKit530', 'WebKit53017'],
249 flags: ['Android', 'Android2', 'Android21'],
250 version: '2.1update1'
256 platform: 'Linux armv7l',
257 userAgent: 'Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Sprint APA9292KT Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko)',
261 flags: ['WebKit', 'WebKit530', 'WebKit53017'],
266 flags: ['Android', 'Android2', 'Android21'],
267 version: '2.1update1'
273 platform: 'BlackBerry',
274 userAgent: 'Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-US) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.246 Mobile Safari/534.1+',
278 flags: ['WebKit', 'WebKit534', 'WebKit5341', 'Safari', 'Safari6', 'Safari600246'],
283 flags: ['BlackBerry', 'BlackBerry6', 'BlackBerry600246'],
302 //~ Ext.each(profiles, function(name) {
303 //~ console.log(arguments);
304 specFor(profiles, function(name) {
305 describe(name, function() {
306 beforeEach(function() {
307 profile = profiles[name];
309 Ext.global = Ext.merge({}, mockGlobal, {
311 platform: profile.platform,
312 userAgent: profile.userAgent
316 expected = profile.expect;
319 afterEach(function() {
323 it("Ext.env.Browser", function() {
324 var browserEnv = new Ext.env.Browser();
326 expect(browserEnv.name).toBe(expected.browser.name);
328 expect(browserEnv.version.toString()).toBe(expected.browser.version);
332 for (var k in browserEnv.is) {
333 if (!browserEnv.is.hasOwnProperty(k)) {
337 if (browserEnv.is[k] === true) {
342 expect(flags.sort()).toEqual(expected.browser.flags.sort());
345 it("Ext.env.OS", function() {
346 var platformEnv = new Ext.env.OS();
348 expect(platformEnv.name).toBe(expected.os.name);
350 expect(platformEnv.version.toString()).toBe(expected.os.version);
354 for (var k in platformEnv.is) {
355 if (!platformEnv.is.hasOwnProperty(k)) {
359 if (platformEnv.is[k] === true) {
364 expect(flags.sort()).toEqual(expected.os.flags.sort());