-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from MailOnline/fix/QA_fixes
Fix/qa fixes
- Loading branch information
Showing
9 changed files
with
126 additions
and
474 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* eslint-disable filenames/match-regex */ | ||
import isIOS from '../isIOS'; | ||
|
||
describe('isIOS', () => { | ||
let origUserAgent; | ||
|
||
beforeEach(() => { | ||
origUserAgent = navigator.userAgent; | ||
|
||
Object.defineProperty(navigator, 'userAgent', { | ||
writable: true | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
Object.defineProperty(navigator, 'userAgent', { | ||
value: origUserAgent, | ||
writable: true | ||
}); | ||
}); | ||
|
||
it('must be a function', () => { | ||
expect(isIOS).toBeInstanceOf(Function); | ||
}); | ||
|
||
it('must return true if the useAgent contains iPad or iPod or iPhone', () => { | ||
expect(isIOS()).toBe(false); | ||
|
||
navigator.userAgent = `iPhone ${origUserAgent}`; | ||
expect(isIOS()).toBe(true); | ||
|
||
navigator.userAgent = `iPad ${origUserAgent}`; | ||
expect(isIOS()).toBe(true); | ||
|
||
navigator.userAgent = `iPod ${origUserAgent}`; | ||
expect(isIOS()).toBe(true); | ||
}); | ||
|
||
it('must return false for IE user agents that contain iPhone', () => { | ||
window.MSStream = true; | ||
|
||
expect(isIOS()).toBe(false); | ||
|
||
navigator.userAgent = `iPhone ${origUserAgent}`; | ||
expect(isIOS()).toBe(false); | ||
|
||
navigator.userAgent = `iPad ${origUserAgent}`; | ||
expect(isIOS()).toBe(false); | ||
|
||
navigator.userAgent = `iPod ${origUserAgent}`; | ||
expect(isIOS()).toBe(false); | ||
|
||
delete window.MSStream; | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/* eslint-disable filenames/match-regex */ | ||
const isIOS = () => /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; | ||
|
||
export default isIOS; |