Skip to content

Commit

Permalink
fix(pdf): Enable pdf font conversion option for Safari user agents (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
jstoffan authored and mergify[bot] committed Sep 12, 2019
1 parent ffb5854 commit d83196c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 44 deletions.
16 changes: 2 additions & 14 deletions src/lib/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
30 changes: 0 additions & 30 deletions src/lib/__tests__/Browser-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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()', () => {
Expand Down

0 comments on commit d83196c

Please sign in to comment.