Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

platform: Version bump to 0.4.0. [jddalton]

  • Loading branch information...
commit ab240f7cafa6adec9e1882e936703485c98bf9d6 1 parent 02e99fb
John-David Dalton jdalton authored
Showing with 15 additions and 14 deletions.
  1. +1 −1  package.json
  2. +14 −13 tests/tests.js
2  package.json
View
@@ -1,6 +1,6 @@
{
"name": "platform",
- "version": "0.3.1",
+ "version": "0.4.0",
"description": "A platform detection library that works on nearly all JavaScript platforms.",
"homepage": "https://github.com/bestiejs/platform.js",
"main": "platform",
27 tests/tests.js
View
@@ -1676,58 +1676,59 @@
});
test('platform.parse', function() {
- var actual = platform.parse('Mozilla/5.0 (Windows; U; en-US) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5');
+ var parse = function(ua) { return platform.parse(ua + ';'); };
+ var actual = parse('Mozilla/5.0 (Windows; U; en-US) AppleWebKit/531.9 (KHTML, like Gecko) AdobeAIR/2.5');
var expected = 'Adobe AIR 2.5 (like Safari 4.x)';
equal(actual.description, expected, 'parse Adobe Air');
- actual = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2');
+ actual = parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2');
expected = 'Chrome 15.0.874.106 on Mac OS X 10.7.2';
equal(actual.description, expected, 'parse Chrome');
- actual = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0');
+ actual = parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:8.0) Gecko/20100101 Firefox/8.0');
expected = 'Firefox 8.0 on Mac OS X 10.7';
equal(actual.description, expected, 'parse Firefox');
- actual = platform.parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)');
+ actual = parse('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)');
expected = 'IE 7.0 on Windows XP';
equal(actual.description, expected, 'parse IE');
- actual = platform.parse('Opera/9.80 (Macintosh; Intel Mac OS X 10.7.2; U; Edition Next; en) Presto/2.9.220 Version/12.00');
+ actual = parse('Opera/9.80 (Macintosh; Intel Mac OS X 10.7.2; U; Edition Next; en) Presto/2.9.220 Version/12.00');
expected = 'Opera 12.00 on Mac OS X 10.7.2';
equal(actual.description, expected, 'parse Opera');
- actual = platform.parse('Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 10.10');
+ actual = parse('Mozilla/5.0 (Windows NT 5.1; U; en; rv:1.8.1) Gecko/20061208 Firefox/2.0.0 Opera 10.10');
expected = 'Opera 10.10 (identifying as Firefox 2.0.0) on Windows XP';
equal(actual.description, expected, 'parse Opera description identifying as Firefox 2.0.0');
expected = 'Presto';
equal(actual.layout, expected, 'parse Opera layout identifying as Firefox 2.0.0');
- actual = platform.parse('Mozilla/4.0 (compatible; MSIE 8.0; Mac_PowerPC; en) Opera 10.52');
+ actual = parse('Mozilla/4.0 (compatible; MSIE 8.0; Mac_PowerPC; en) Opera 10.52');
expected = 'Opera 10.52 (identifying as IE 8.0)';
equal(actual.description, expected, 'parse Opera description identifying as IE 8.0');
- actual = platform.parse('Mozilla/5.0 (compatible; MSIE 9.0; Mac_PowerPC; en) Opera 12.00');
+ actual = parse('Mozilla/5.0 (compatible; MSIE 9.0; Mac_PowerPC; en) Opera 12.00');
expected = 'Opera 12.00 (identifying as IE 9.0)';
equal(actual.description, expected, 'parse Opera description identifying as IE 9.0');
- actual = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0');
+ actual = parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0');
expected = 'Opera (masking as Firefox 4.0) on Mac OS X 10.7.2';
equal(actual.description, expected, 'parse Opera description masking as Firefox 4.0');
- actual = platform.parse('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; en)');
+ actual = parse('Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; en)');
expected = 'Opera (masking as IE 8.0)';
equal(actual.description, expected, 'parse Opera description masking as IE 8.0');
- actual = platform.parse('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.1; Trident/5.0; en)');
+ actual = parse('Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.1; Trident/5.0; en)');
expected = 'Opera (masking as IE 9.0)';
equal(actual.description, expected, 'parse Opera description masking as IE 9.0');
- actual = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22');
+ actual = parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.51.22 (KHTML, like Gecko) Version/5.1.1 Safari/534.51.22');
expected = 'Safari 5.1.1 on Mac OS X 10.7.2';
equal(actual.description, expected, 'parse Safari');
- actual = platform.parse('Mozilla/5.0 (X11; U; Cygwin; C -) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) PhantomJS/1.0.0');
+ actual = parse('Mozilla/5.0 (X11; U; Cygwin; C -) AppleWebKit/527+ (KHTML, like Gecko, Safari/419.3) PhantomJS/1.0.0');
expected = 'PhantomJS 1.0.0 (like Safari 4.x) on Cygwin';
equal(actual.description, expected, 'parse PhantomJS');
});
Please sign in to comment.
Something went wrong with that request. Please try again.