123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
- <link rel="stylesheet" href="test.css">
- <title>Zepto Detect unit tests</title>
- <script src="../vendor/evidence.js"></script>
- <script src="evidence_runner.js"></script>
- <script>
- // avoid caching
- (function(){
- function load(scripts){
- scripts.split(' ').forEach(function(script){
- document.write('<script src="../src/'+script+'.js?'+(+new Date)+'"></scr'+'ipt>')
- })
- }
- load('zepto detect ie')
- })()
- </script>
- </head>
- <body>
- <h1>Zepto Detect unit tests</h1>
- <p id="results">
- Running… see browser console for results
- </p>
- <script>
- (function(){
- var UA = {
- Safari_OSX_7_0_1: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) Version/7.0.1 Safari/537.73.11",
- Safari_OSX_7_0: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9) AppleWebKit/537.71 (KHTML, like Gecko) Version/7.0 Safari/537.71",
- Safari_OSX_6_0: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8) AppleWebKit/536.25 (KHTML, like Gecko) Version/6.0 Safari/536.25",
- Safari_Windows_NT: "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.20.25 (KHTML, like Gecko) Version/5.0.4 Safari/533.20.27",
- WebOS_1_4_0_Pre: "Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pre/1.1",
- WebOS_1_4_0_Pixi: "Mozilla/5.0 (webOS/1.4.0; U; en-US) AppleWebKit/532.2 (KHTML, like Gecko) Version/1.0 Safari/532.2 Pixi/1.1",
- WebOS_1_2_9_Pixi: "Mozilla/5.0 (webOS/Palm webOS 1.2.9; U; en-US) AppleWebKit/525.27.1 (KHTML, like Gecko) Version/1.0 Safari/525.27.1 Pixi/1.0",
- WebOS_3_0_0_TouchPad: "Mozilla/5.0 (hp-tablet; Linux; hpwOS/3.0.0; U; en-US) AppleWebKit/534.6 (KHTML, like Gecko) wOSBrowser/233.70 Safari/534.6 TouchPad/1.0",
- iOS_3_0_iPhone: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/1A542a Safari/419.3",
- iOS_4_0_iPhone: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7",
- iOS_3_1_1_iPod: "Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1_1 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Mobile/7C145",
- iOS_3_2_iPad: "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/7B367 Safari/531.21.10",
- iOS_4_2_iPad: "Mozilla/5.0 (iPad; U; CPU OS 4_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8C134 Safari/6533.18.5",
- iOS_4_3_iPhone_Simulator: "Mozilla/5.0 (iPhone Simulator; U; CPU iPhone OS 4_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8F190 Safari/6533.18.5",
- iOS_5_0_iPhone: "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3",
- iOS_5_1_iPad_webView: "Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/98176",
- iOS_6_0_iPad_mini: "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A406 Safari/8536.25",
- iOS_6_1_iPhone: "Mozilla/5.0 (iPhone; CPU iPhone OS 6_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B143 Safari/8536.25",
- iOS_3_2_iPad_2: "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",
- iOS_7_0_iPhone: "Mozilla 5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KTHML, like Gecko) Version/7.0 Mobile/11A449d Safari/9537.53",
- iOS_7_0_iPhone_Chrome: "Mozilla 5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/536.26 (KHTM, like Gecko) CriOS/28.0.1500.17 Mobile/11A4449d Safari/8536.25",
- Android_1_5: "Mozilla/5.0 (Linux; U; Android 1.5; de-; HTC Magic Build/PLAT-RC33) AppleWebKit/528.5+ (KHTML, like Gecko) Version/3.1.2 Mobile Safari/525.20.1",
- Android_2_1: "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 Chrome/4.1.249.1025",
- Android_2_3: "Mozilla/5.0 (Linux; U; Android 2.3.7; en-us; Nexus One Build/GRK39F) AppleWebKit/533.1 (KTHML, like Gecko) Version/4.0 Mobile Safari/533.1",
- Android_2_3_Lenovo_A750: "Lenovo-A750/S102 Linux/2.6.35.7 Android/2.3 Release/12.12.2011 Browser AppleWebkit533.1 Profile/ Configuration/",
- Android_4_1_1: "Mozilla/5.0 (Linux; Android 4.1.1; Galaxy Nexus Build/JRO03O) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19",
- Android_4_1_1_Tablet: "Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03S) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19",
- Android_4_3: "Mozilla/5.0 (Linux; Android 4.3; Nexus 4 Build/JWR66Y) AppleWebKit/537.36 (KTHML, like Gecko) Chrome/29.0.1547.59 Mobile Safari/537.36",
- BlackBerry_6_0_0_141: "Mozilla/5.0 (BlackBerry; U; BlackBerry 9800; en-GB) AppleWebKit/534.1+ (KHTML, like Gecko) Version/6.0.0.141 Mobile Safari/534.1+",
- PlayBook_1_0_0: "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 1.0.0; en-US) AppleWebKit/534.8+ (KHTML, like Gecko) Version/0.0.1 Safari/534.8+",
- PlayBook_2_1_0: "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+",
- BB10: "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+",
- Opera_11_51: "Opera/9.80 (Macintosh; Intel Mac OS X 10.7.1; U; en) Presto/2.9.168 Version/11.51",
- Opera_Mobile_Simulator: "Opera/9.80 (Macintosh; Intel Mac OS X; Opera Mobi/[BUILD_NR]; U; en) Presto/2.7.81 Version/11.00",
- Kindle: "Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600×800; rotate)",
- Silk_1_0_accel: "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_3; en-us; Silk/1.0.13.328_10008910) AppleWebKit/533.16 (KHTML, like Gecko) Version/5.0 Safari/533.16 Silk-Accelerated=true",
- Silk_1_0: "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Kindle Fire Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1",
- Chrome_Android_18_0: "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
- Chrome_iOS_19_0: "Mozilla/5.0 (iPhone; U; CPU iPhone OS 5_1_1 like Mac OS X; en) AppleWebKit/534.46.0 (KHTML, like Gecko) CriOS/19.0.1084.60 Mobile/9B206 Safari/7534.48.3",
- Chrome_OSX_24_0: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.56 Safari/537.17",
- Firefox_13_Tablet: "Mozilla/5.0 (Android; Tablet; rv:13.0) Gecko/13.0 Firefox/13.0",
- Firefox_13_Phone: "Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0",
- Firefox_6_0_2: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0.2) Gecko/20100101 Firefox/6.0.2",
- Firefox_Mobile_Simulator: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:2.1.1) Gecko/ Firefox/4.0.2pre Fennec/4.0.1",
- Firefox_Os_Phone: "Mozilla/5.0 (Mobile; rv:18.0) Gecko/18.0 Firefox/18.0",
- Firefox_Os_Tablet: "Mozilla/5.0 (Tablet; rv:18.0) Gecko/18.0 Firefox/18.0",
- Windows_IE_9: "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)",
- Windows_IE_9_Compat: "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/5.0)",
- Windows_IE_10: "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)",
- Windows_IE_11: "Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko",
- Windows_RT_Surface: "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0; Touch)",
- Windows_Phone_8: "Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; HTC; Windows Phone 8X by HTC)"
- }
- function detect(ua, platform, callback){
- if (!callback) callback = platform, platform = ""
- var obj = {}
- $.__detect.call(obj, ua, platform)
- callback.call(null, obj.os, obj.browser)
- }
- Evidence('ZeptoDetectTest', {
- testSafariOSX: function(t){
- detect(UA.Safari_OSX_7_0_1, function(os, browser){
- t.assertUndefined(os.osx)
- t.assert(!os.ipad)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.chrome)
- t.assertEqual("7.0.1",browser.version)
- })
- detect(UA.Safari_OSX_7_0, function(os, browser){
- t.assert(!os.ipad)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.chrome)
- t.assertEqual("7.0",browser.version)
- })
- detect(UA.Safari_OSX_6_0, function(os, browser){
- t.assert(!os.ipad)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.chrome)
- t.assertEqual("6.0",browser.version)
- })
- },
- testSafariWindows: function(t){
- detect(UA.Safari_Windows_NT, "Windows", function(os, browser){
- t.assertUndefined(os.osx)
- t.assertUndefined(os.ios)
- t.assertUndefined(os.wp)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.chrome)
- t.assertEqual("5.0.4", browser.version)
- })
- },
- testWebOS: function(t){
- detect(UA.WebOS_1_4_0_Pre, function(os, browser){
- t.assertTrue(os.webos)
- t.assert(!os.touchpad)
- t.assertTrue(browser.webkit)
- t.assertEqual("1.4.0", os.version)
- })
- detect(UA.WebOS_1_4_0_Pixi, function(os){
- t.assertTrue(os.webos)
- t.assertEqual("1.4.0", os.version)
- })
- detect(UA.WebOS_1_2_9_Pixi, function(os){
- t.assertTrue(os.webos)
- t.assertEqual("1.2.9", os.version)
- })
- detect(UA.WebOS_3_0_0_TouchPad, function(os){
- t.assertTrue(os.webos)
- t.assertTrue(os.touchpad)
- t.assertEqual("3.0.0", os.version)
- })
- },
- testAndroid: function(t){
- detect(UA.Android_1_5, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertEqual("1.5", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(!!browser.safari)
- })
- detect(UA.Android_2_1, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertEqual("2.1", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(!!browser.safari)
- })
- detect(UA.Android_2_3, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertEqual("2.3.7", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(!!browser.safari)
- })
- detect(UA.Android_2_3_Lenovo_A750, function(os, browser){
- t.assertTrue(os.android, 'Expected Android')
- t.assertTrue(browser.webkit, 'Expected WebKit')
- t.assertEqual("2.3", os.version)
- // FIXME: Unfortunately we can't detect if it's a phone, as there's
- // no "mobile" in the UA string.
- // t.assertTrue(os.phone, 'Expected phone')
- t.assertFalse(!!browser.safari, 'Expected browser to not be Safari')
- })
- detect(UA.Android_4_1_1, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertFalse(!!os.ios)
- t.assertEqual("4.1.1", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(!!os.iphone)
- t.assertTrue(browser.chrome)
- t.assertFalse(!!browser.safari)
- })
- detect(UA.Android_4_1_1_Tablet, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertEqual("4.1.1", os.version)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.chrome)
- t.assertFalse(!!browser.safari)
- })
- detect(UA.Android_4_3, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertFalse(!!os.ios)
- t.assertEqual("4.3", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(!!os.iphone)
- t.assertTrue(browser.chrome)
- t.assertFalse(!!browser.safari)
- })
- },
- testIOS: function(t){
- detect(UA.iOS_3_0_iPhone, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.iphone)
- t.assertTrue(browser.webkit)
- t.assertEqual("3.0", os.version)
- t.assertEqual("420.1", browser.version)
- t.assertTrue(os.phone)
- t.assertTrue(browser.safari)
- t.assertFalse(!!os.android)
- t.assertFalse(!!browser.ie)
- t.assertFalse(!!browser.firefox)
- t.assertFalse(!!browser.silk)
- t.assertFalse(!!browser.chrome)
- t.assertFalse(!!browser.playbook)
- })
- detect(UA.iOS_3_1_1_iPod, function(os, browser){
- t.assertTrue(os.ios)
- t.assertUndefined(os.iphone)
- t.assertTrue(os.ipod)
- t.assertEqual("3.1.1", os.version)
- t.assertFalse(!!os.phone)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_3_2_iPad, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.ipad)
- t.assertFalse(!!os.iphone)
- t.assertEqual("3.2", os.version)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_3_2_iPad_2, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.ipad)
- t.assert(!os.iphone)
- t.assertEqual("3.2", os.version)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_4_0_iPhone, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.iphone)
- t.assert(!os.ipad)
- t.assertEqual("4.0", os.version)
- t.assertTrue(os.phone)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_4_2_iPad, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.ipad)
- t.assertEqual("4.2", os.version)
- t.assertFalse(os.phone)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_4_3_iPhone_Simulator, function(os, browser){
- t.assertTrue(os.ios)
- t.assertTrue(os.iphone)
- t.assertEqual("4.3", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_5_0_iPhone, function(os, browser){
- t.assert(os.ios)
- t.assert(os.iphone)
- t.assertEqual("5.0", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_5_1_iPad_webView, function(os, browser){
- t.assert(os.ios)
- t.assert(os.ipad)
- t.assertEqual("5.1", os.version)
- t.assertTrue(browser.webview)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_6_1_iPhone, function(os, browser){
- t.assert(os.ios)
- t.assert(os.iphone)
- t.assertEqual("6.1", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.webview)
- t.assertFalse(!!browser.chrome)
- t.assertFalse(!!browser.firefox)
- })
- detect(UA.iOS_6_0_iPad_mini, function(os, browser){
- t.assert(os.ios)
- t.assert(os.ipad)
- t.assertEqual("6.0", os.version)
- t.assertFalse(os.phone)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.safari)
- })
- detect(UA.iOS_7_0_iPhone, function(os, browser){
- t.assert(os.ios)
- t.assert(os.iphone)
- t.assertEqual("7.0", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.safari)
- t.assertFalse(!!browser.chrome)
- t.assertFalse(!!browser.firefox)
- })
- detect(UA.iOS_7_0_iPhone_Chrome, function(os, browser){
- t.assert(os.ios)
- t.assert(os.iphone)
- t.assertEqual("7.0", os.version)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertFalse(!!browser.safari)
- t.assertTrue(browser.chrome)
- t.assertFalse(!!browser.firefox)
- t.assertFalse(!!browser.webview)
- })
- },
- testBlackBerry: function(t) {
- detect(UA.BlackBerry_6_0_0_141, function(os, browser){
- t.assertTrue(os.blackberry)
- t.assertTrue(browser.webkit)
- t.assertEqual("6.0.0.141", os.version)
- }),
- detect(UA.PlayBook_1_0_0, function(os, browser){
- t.assertTrue(os.rimtabletos)
- t.assertTrue(browser.webkit)
- t.assertTrue(os.tablet)
- t.assertEqual("1.0.0", os.version)
- })
- detect(UA.PlayBook_2_1_0, function(os, browser){
- t.assertTrue(os.rimtabletos)
- t.assertTrue(browser.webkit)
- t.assertTrue(os.tablet)
- t.assertEqual("2.1.0", os.version)
- })
- detect(UA.BB10, function(os, browser){
- t.assertTrue(os.bb10)
- t.assertTrue(browser.webkit)
- t.assertTrue(os.phone)
- t.assertEqual("10.0.0.1337", os.version)
- })
- },
- testKindle: function(t) {
- detect(UA.Kindle, function(os, browser){
- t.assertTrue(os.kindle)
- t.assertTrue(browser.webkit)
- t.assertEqual("3.0", os.version)
- })
- detect(UA.Silk_1_0, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.silk)
- t.assertEqual("2.3.4", os.version)
- })
- detect(UA.Silk_1_0_accel, function(os, browser){
- t.assert(!os.android)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.silk)
- t.assertEqual("1.0.13.328_10008910", browser.version)
- })
- },
- testFirefox: function(t) {
- detect(UA.Firefox_6_0_2, function(os, browser){
- t.assertFalse(browser.webkit)
- t.assertEqual('6.0.2', browser.version)
- t.assertTrue(browser.firefox)
- t.assertFalse(!!os.firefoxos)
- })
- detect(UA.Firefox_13_Tablet, function(os, browser){
- t.assertTrue(browser.firefox)
- t.assertFalse(browser.webkit)
- t.assertTrue(os.android)
- t.assertFalse(os.phone)
- t.assertTrue(os.tablet)
- t.assertFalse(!!os.firefoxos)
- })
- detect(UA.Firefox_13_Phone, function(os, browser){
- t.assertTrue(browser.firefox)
- t.assertFalse(browser.webkit)
- t.assertTrue(os.android)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertFalse(!!os.firefoxos)
- })
- detect(UA.Firefox_Os_Phone, function(os, browser){
- t.assertTrue(browser.firefox)
- t.assertFalse(browser.webkit)
- t.assertTrue(os.firefoxos)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertEqual('18.0', os.version)
- })
- detect(UA.Firefox_Os_Tablet, function(os, browser){
- t.assertTrue(browser.firefox)
- t.assertFalse(browser.webkit)
- t.assertTrue(os.firefoxos)
- t.assertTrue(os.tablet)
- t.assertFalse(os.phone)
- t.assertEqual('18.0', os.version)
- })
- },
- testOpera: function(t) {
- detect(UA.Opera_11_51, function(os, browser){
- t.assertFalse(browser.webkit)
- t.assertUndefined(browser.version)
- })
- },
- testChrome: function(t) {
- detect(UA.Chrome_Android_18_0, function(os, browser){
- t.assertTrue(os.android)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.chrome)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertEqual("18.0.1025.133", browser.version)
- })
- detect(UA.Chrome_iOS_19_0, function(os, browser){
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(os.ios)
- t.assertTrue(browser.webkit)
- t.assertTrue(browser.chrome)
- t.assertEqual("19.0.1084.60", browser.version)
- })
- detect(UA.Chrome_OSX_24_0, function(os, browser){
- t.assertFalse(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.chrome)
- })
- },
- testIE: function(t) {
- detect(UA.Windows_IE_11, function(os, browser){
- t.assertFalse(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("11", browser.version)
- })
- detect(UA.Windows_IE_10, function(os, browser){
- t.assertFalse(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("10.0", browser.version)
- })
- detect(UA.Windows_RT_Surface, function(os, browser){
- t.assertFalse(os.phone)
- t.assertTrue(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("10.0", browser.version)
- })
- detect(UA.Windows_Phone_8, function(os, browser){
- t.assertTrue(os.wp)
- t.assertTrue(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("10.0", browser.version)
- })
- detect(UA.Windows_IE_9, function(os, browser){
- t.assertFalse(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("9.0", browser.version)
- })
- detect(UA.Windows_IE_9_Compat, function(os, browser){
- t.assertFalse(os.phone)
- t.assertFalse(os.tablet)
- t.assertTrue(browser.ie)
- t.assertEqual("7.0", browser.version)
- })
- }
- })
- })()
- </script>
- </body>
- </html>
|