Skip to content

Commit

Permalink
More test for latest phones with unique form factor (fold/flip/qwerty…
Browse files Browse the repository at this point in the history
…/swivel)
  • Loading branch information
faisalman committed Apr 4, 2021
1 parent c937400 commit 557cc21
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ua-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@

// Motorola
/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,
/\smot[\s-](\w*)/i,
/\smot(?:orola)?[\s-](\w*)/i,
/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i
], [MODEL, [VENDOR, 'Motorola'], [TYPE, MOBILE]], [
/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i
Expand All @@ -440,7 +440,7 @@
// LG
/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i
], [MODEL, [VENDOR, 'LG'], [TYPE, TABLET]], [
/(nexus\s[45])/i,
/(lm-?f100[nv]?|nexus\s[45])/i,
/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,
/\blg(\-?[\d\w]+)\sbuild/i
], [MODEL, [VENDOR, 'LG'], [TYPE, MOBILE]], [
Expand All @@ -453,7 +453,7 @@
// Nokia
/(?:maemo|nokia).*(n900|lumia\s\d+)/i,
/nokia[\s_-]?([\w\.-]*)/i
], [MODEL, [VENDOR, 'Nokia'], [TYPE, MOBILE]], [
], [[MODEL, /_/g, ' '], [VENDOR, 'Nokia'], [TYPE, MOBILE]], [

// Google
/droid.+;\s(pixel\sc)[\s)]/i // Google Pixel C
Expand Down Expand Up @@ -485,6 +485,7 @@
// BlackBerry
/\((playbook);[\w\s\),;-]+(rim)/i // BlackBerry PlayBook
], [MODEL, VENDOR, [TYPE, TABLET]], [
/((?:bb[a-f]|st[hv])100-\d)/i,
/\(bb10;\s(\w+)/i // BlackBerry 10
], [MODEL, [VENDOR, 'BlackBerry'], [TYPE, MOBILE]], [

Expand Down
108 changes: 108 additions & 0 deletions test/device-test.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,42 @@
"type": "tablet"
}
},
{
"desc": "BlackBerry Priv",
"ua": "User-Agent: Mozilla/5.0 (Linux; Android 5.1.1; STV100-1 Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/46.0.2490.76 Mobile Safari/537.36",
"expect": {
"vendor": "BlackBerry",
"model": "STV100-1",
"type": "mobile"
}
},
{
"desc": "BlackBerry Keyone",
"ua": "Mozilla/5.0 (Linux; Android 8.1.0; BBB100-1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.111 Mobile Safari/537.36",
"expect": {
"vendor": "BlackBerry",
"model": "BBB100-1",
"type": "mobile"
}
},
{
"desc": "BlackBerry Key2",
"ua": "Mozilla/5.0 (Linux; Android 8.1.0; BBF100-1 Build/OPM1.171019.026) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.91 Mobile Safari/537.36",
"expect": {
"vendor": "BlackBerry",
"model": "BBF100-1",
"type": "mobile"
}
},
{
"desc": "BlackBerry Key2 LE",
"ua": "User-Agent: Mozilla/5.0 (Linux; Android 8.1.0; BBE100-1 Build/OPM1.171019.026) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497 Mobile Safari/537.36",
"expect": {
"vendor": "BlackBerry",
"model": "BBE100-1",
"type": "mobile"
}
},
{
"desc": "Desktop (IE11 with Tablet string)",
"ua": "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; Tablet PC 2.0; GWX:MANAGED; rv:11.0) like Gecko",
Expand Down Expand Up @@ -331,6 +367,15 @@
"type": "mobile"
}
},
{
"desc": "LG Wing",
"ua": "Mozilla/5.0 (Linux; Android 10; LM-F100N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.101 Mobile Safari/537.36",
"expect": {
"vendor": "LG",
"model": "LM-F100N",
"type": "mobile"
}
},
{
"desc": "LG Smart TV",
"ua": "Mozilla/5.0 (DirectFB; U; Linux mips; en) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) LG Browser (; LG NetCast.TV-2011)",
Expand Down Expand Up @@ -423,6 +468,15 @@
"type": "mobile"
}
},
{
"desc": "Motorola RAZR 2019",
"ua": "Mozilla/5.0 (Linux; Android 9; motorola razr) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/11.1 Chrome/75.0.3770.143 Mobile Safari/537.36",
"expect": {
"vendor": "Motorola",
"model": "razr",
"type": "mobile"
}
},
{
"desc": "iPhone",
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53",
Expand Down Expand Up @@ -540,6 +594,15 @@
"type": "mobile"
}
},
{
"desc": "Nokia 2720 Flip",
"ua": "Mozilla/5.0 (Mobile; Nokia_2720_Flip; rv:48.0) Gecko/48.0 Firefox/48.0 KAIOS/2.5.2",
"expect": {
"vendor": "Nokia",
"model": "2720 Flip",
"type": "mobile"
}
},
{
"desc": "OnePlus One",
"ua": "Mozilla/5.0 (Linux; Android 4.4.4; A0001 Build/KTU84Q) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.59 Mobile Safari/537.36",
Expand Down Expand Up @@ -810,6 +873,24 @@
"type": "mobile"
}
},
{
"desc": "Samsung Galaxy Z Flip",
"ua": "Mozilla/5.0 (Linux; Android 10; SM-F700N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.136 Mobile Safari/537.36",
"expect": {
"vendor": "Samsung",
"model": "SM-F700N",
"type": "mobile"
}
},
{
"desc": "Samsung Galaxy Z Fold2",
"ua": "Mozilla/5.0 (Linux; Android 10; SM-F916B) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Mobile Safari/537.36",
"expect": {
"vendor": "Samsung",
"model": "SM-F916B",
"type": "mobile"
}
},
{
"desc": "Samsung Galaxy S10E",
"ua": "Mozilla/5.0 (Linux; Android 9; SM-G970F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Mobile Safari/537.36",
Expand Down Expand Up @@ -1984,6 +2065,24 @@
"type": "mobile"
}
},
{
"desc": "Huawei Mate X",
"ua": "Mozilla/5.0 (Linux; Android 9; TAH-AN00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.111 Safari/537.36",
"expect": {
"vendor": "Huawei",
"model": "TAH-AN00",
"type": "mobile"
}
},
{
"desc": "Huawei Mate X2",
"ua": "Mozilla/5.0 (Linux; Android 10; TET-AN00) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.96 Mobile Safari/537.36",
"expect": {
"vendor": "Huawei",
"model": "TET-AN00",
"type": "mobile"
}
},
{
"desc": "Huawei P20 Lite",
"ua": "Mozilla/5.0 (Linux; Android 8.0.0; ANE-LX1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.143 Mobile Safari/537.36",
Expand Down Expand Up @@ -2171,6 +2270,15 @@
"type": "mobile"
}
},
{
"desc": "Alcatel Go Flip",
"ua": "Mozilla/5.0 (Mobile; ALCATEL4044T; rv:37.0) Gecko/37.0 Firefox/37.0 KaiOS/1.0",
"expect": {
"vendor": "ALCATEL",
"model": "4044T",
"type": "mobile"
}
},
{
"desc": "Jolla",
"ua": "Mozilla/5.0 (Maemo; Linux; U; Jolla; Sailfish; Mobile; rv:31.0) Gecko/31.0 Firefox/31.0 SailfishBrowser/1.0",
Expand Down

0 comments on commit 557cc21

Please sign in to comment.