1 describe("Ext.Support", function() {
2 describe("Ext.is", function() {
5 detect: function(navigatorObject) {
8 Ext.is.init(navigatorObject);
11 result.push('Desktop');
14 result.push('Tablet');
24 result.push('iPhone');
34 result.push('Windows');
40 result.push('Android');
45 if (Ext.is.Blackberry) {
46 result.push('BlackBerry');
49 // Reset back to use actual navigator host object
50 Ext.is.init(window.navigator);
52 return result.join(' ');
59 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'
64 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'
69 userAgent: 'Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.6.30 Version/10.63'
75 userAgent: 'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; Media Center PC 6.0)'
80 userAgent: 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; .NET CLR 3.5.30729)'
85 userAgent: 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)'
90 userAgent: 'Mozilla/4.0 (compatible; MSIE 6.1; Windows XP)'
95 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101203 Firefox/3.6.13'
100 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.15) Gecko/20101026 Firefox/3.5.15'
105 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19'
110 userAgent: 'Opera/9.80 (Windows NT 5.1; U; en) Presto/2.5.24 Version/10.54'
115 userAgent: 'Opera/9.64 (Windows NT 5.1; U; en) Presto/2.1.1'
120 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4'
125 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'
130 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.28.3 (KHTML, like Gecko) Version/3.2.3 Safari/525.29'
135 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10'
140 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7'
145 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.2 (KHTML, like Gecko) Chrome/6.0.453.1 Safari/534.2'
150 userAgent: 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.126 Safari/533.4'
156 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'
159 'Phone iPhone iOS': {
162 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'
168 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'
173 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 'Phone Linux Android': {
178 platform: 'Linux armv7l',
179 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'
183 platform: 'Linux armv7l',
184 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'
187 Android_22_NexusOne: {
188 platform: 'Linux armv7l',
189 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'
192 Android_21_GalaxyS: {
193 platform: 'Linux armv7l',
194 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'
198 platform: 'Linux armv7l',
199 userAgent: 'Mozilla/5.0 (Linux; U; Android 2.1-update1; en-us; Sprint APA9292KT Build/ERE27) AppleWebKit/530.17 (KHTML, like Gecko)'
202 'Phone BlackBerry': {
204 platform: 'BlackBerry',
205 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+'
210 generateSpecsFor = function(type) {
211 for (var data in platform.data[type]) {
212 if (platform.data.hasOwnProperty(type)) {
213 it("should detect " + data + " as " + type, function() {
214 expect(platform.detect(platform.data[type][data])).toEqual(type);
220 generateSpecsFor('Desktop Mac');
221 generateSpecsFor('Desktop Windows');
222 generateSpecsFor('Tablet iPad iOS');
223 generateSpecsFor('Phone iPhone iOS');
224 generateSpecsFor('Phone iPod iOS');
225 generateSpecsFor('Phone Linux Android');
226 generateSpecsFor('Phone BlackBerry');
229 describe("Ext.supports", function() {
231 describe("OrientationChange", function() {
232 it("should return true when supported", function() {
233 expect(Ext.supports.OrientationChange).toBe((typeof window.orientation != 'undefined') && ('onorientationchange' in window));
237 describe("DeviceMotion", function() {
238 it("should return true when supported", function() {
239 expect(Ext.supports.DeviceMotion).toBe('ondevicemotion' in window);
243 describe("Touch", function() {
244 it("should return true when supported", function() {
245 expect(Ext.supports.Touch).toBe(('ontouchstart' in window) && (!Ext.is.Desktop));