diff --git a/src/utils.js b/src/utils.js index 6f56c3dd..142173b3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1548,7 +1548,7 @@ _.info = { 'Firefox iOS': /FxiOS\/(\d+(\.\d+)?)/, 'Konqueror': /Konqueror:(\d+(\.\d+)?)/, 'BlackBerry': /BlackBerry (\d+(\.\d+)?)/, - 'Android Mobile': /android\s(\d+(\.\d+)?)/, + 'Android Mobile': /Android\s(\d+(\.\d+)?)/, 'Samsung Internet': /SamsungBrowser\/(\d+(\.\d+)?)/, 'Internet Explorer': /(rv:|MSIE )(\d+(\.\d+)?)/, 'Mozilla': /rv:(\d+(\.\d+)?)/, diff --git a/tests/unit/utils.js b/tests/unit/utils.js index 6201ebb0..1fb083d4 100644 --- a/tests/unit/utils.js +++ b/tests/unit/utils.js @@ -204,6 +204,20 @@ describe(`_.info helper methods`, function() { expect(pageViewProperties.current_url_search).to.equal(`?utm_source=google`); }); }); + + describe(`_.info.browserVersion`, function() { + // Real Samsung stock browser UA on Android 4.4.2 (no "Chrome" token, so + // it is detected as "Android Mobile" rather than "Chrome"). + var androidMobileUA = `Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Mobile Safari/537.36`; + + it(`detects "Android Mobile" browsers`, function() { + expect(_.info.browser(androidMobileUA, ``, false)).to.equal(`Android Mobile`); + }); + + it(`parses the version for "Android Mobile" browsers`, function() { + expect(_.info.browserVersion(androidMobileUA, ``, false)).to.equal(4.4); + }); + }); }); describe(`_.isBlockedUA`, function() {