Skip to content

Commit

Permalink
Fixed Edge detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Marek Sierociński committed Oct 28, 2020
1 parent 604e955 commit 10deb94
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 13 deletions.
4 changes: 2 additions & 2 deletions dist/smartbear-browser-info.embed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/smartbear-browser-info.embed.min.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/smartbear-browser-info.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/smartbear-browser-info.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/smartbear-browser-info.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/smartbear-browser-info.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@smartbear/browser-info",
"version": "1.3.0",
"version": "1.3.1",
"description": "Tiny developer-friendly JS library that provides information about host browser",
"main": "dist/smartbear-browser-info.min.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/known-browsers.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Entity } from './Entity';

const browsers = [
new Entity('Firefox', /Firefox\/([0-9.]+)/),
new Entity('Edge', /Edge\/([0-9.]+)/),
new Entity('Edge', /Edg[AeiOS]{0,3}\/([0-9.]+)/),
new Entity('Opera', /OPR\/([0-9.]+)/),
new Entity('SamsungInternet', /SamsungBrowser\/([0-9.]+)/),
new Entity('UCBrowser', /UCBrowser\/([0-9.]+)/),
Expand Down
30 changes: 30 additions & 0 deletions test/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,36 @@
"versionAsNumber": 1310537
}
},
{
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.74 Safari/537.36 Edg/79.0.309.43",
"expected": {
"os": "Windows",
"name": "Edge",
"release": 79,
"version": "79.0.309.43",
"versionAsNumber": 79030943
}
},
{
"userAgent": "Mozilla/5.0 (Linuxl Android 7.0; Moto G(4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.116 Mobile Safari/537.36 EdgA/45.09.2.5079",
"expected": {
"os": "Android",
"name": "Edge",
"release": 45,
"version": "45.09.2.5079",
"versionAsNumber": 450925079
}
},
{
"userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Mobile/14F89 Safari/603.2.4 EdgiOS/41.1.35.1",
"expected": {
"os": "iOS",
"name": "Edge",
"release": 41,
"version": "41.1.35.1",
"versionAsNumber": 411351
}
},
{
"userAgent": "Mozilla/5.0 (Windows Phone 10.0; Android 4.2.1; Microsoft; Lumia 640 XL LTE Dual SIM) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Mobile Safari/537.36 Edge/12.10166",
"expected": {
Expand Down
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Test known combinations', () => {
const data = require('./data.json');
for (const entity of data) {

it(`${entity.expected.name} @ ${entity.expected.os}`, () => {
it(`${entity.expected.name} ${entity.expected.version} @ ${entity.expected.os}`, () => {
BrowserInfo.detect(entity.userAgent);
expect(BrowserInfo.os).to.be.eq(entity.expected.os);
expect(BrowserInfo.name).to.be.eq(entity.expected.name);
Expand Down

0 comments on commit 10deb94

Please sign in to comment.