From 0cbf1f94bf3d36a6bdb19280b64e195b9586b86e Mon Sep 17 00:00:00 2001 From: Jared Stoffan Date: Thu, 12 Sep 2019 13:51:03 -0700 Subject: [PATCH] fix(pdf): Enable pdf font conversion option for Safari user agents --- src/lib/Browser.js | 16 ++-------------- src/lib/__tests__/Browser-test.js | 30 ------------------------------ 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/src/lib/Browser.js b/src/lib/Browser.js index 710a5c6b5..322d6f7bf 100644 --- a/src/lib/Browser.js +++ b/src/lib/Browser.js @@ -319,26 +319,14 @@ class Browser { } /** - * Returns whether or not the device is a laptop/desktop Mac - * - * @public - * @return {boolean} Whether device is a Mac - */ - static isMac() { - return /Macintosh; Intel Mac OS X/g.test(userAgent); - } - - /** - * Returns whether or not the device is running IOS 10.3.x or browser is desktop Safari, both of which have Font + * Returns whether or not the device is running IOS 10.3.x, which has Font * Ligature rendering issues due to the font loading API. * * @public * @return {boolean} Whether device or browser have font ligature issues */ static hasFontIssue() { - return ( - (Browser.isIOS() && /(?:OS\s)10_3/i.test(userAgent)) || (Browser.isMac() && Browser.getName() === 'Safari') - ); + return Browser.isIOS() && /(?:OS\s)10_3/i.test(userAgent); } /** diff --git a/src/lib/__tests__/Browser-test.js b/src/lib/__tests__/Browser-test.js index 0c7ca04bb..712e80756 100644 --- a/src/lib/__tests__/Browser-test.js +++ b/src/lib/__tests__/Browser-test.js @@ -467,20 +467,6 @@ describe('lib/Browser', () => { }); }); - describe('isMac()', () => { - it('should return true if device is a Mac', () => { - Browser.overrideUserAgent('(Macintosh; Intel Mac OS X 10_10_4)'); - const mac = Browser.isMac(); - expect(mac).to.be.true; - }); - - it('should return false if device is not a Mac', () => { - Browser.overrideUserAgent('(Windows NT 6.1; Win64; x64; rv:47.0)'); - const mac = Browser.isMac(); - expect(mac).to.be.false; - }); - }); - describe('hasFontIssue()', () => { it('should return true if device is on ios and is OS 10.3.XX', () => { Browser.overrideUserAgent('iPhone OS 10_3_90 safari/2'); @@ -493,22 +479,6 @@ describe('lib/Browser', () => { const hasIssue = Browser.hasFontIssue(); expect(hasIssue).to.be.false; }); - - it('should return true if device is a Mac running Safari', () => { - Browser.overrideUserAgent( - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_4) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/8.0.7 Safari/600.7.12', - ); - const hasIssue = Browser.hasFontIssue(); - expect(hasIssue).to.be.true; - }); - - it('should return false if device is a Mac and not on Safari', () => { - Browser.overrideUserAgent( - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36', - ); - const hasIssue = Browser.hasFontIssue(); - expect(hasIssue).to.be.false; - }); }); describe('getBrowserInfo()', () => {