Skip to content

Commit

Permalink
fix(cdk): fix isFirefox check (#158)
Browse files Browse the repository at this point in the history
* fix(browser-detection): fix isFirefox check

* fix(cdk): userAgent case sensitive checks
  • Loading branch information
WynieCronje authored Jan 27, 2021
1 parent b35a891 commit 8e9c7a4
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion projects/cdk/utils/browser/is-IE.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function isIE(userAgent: string): boolean {
return userAgent.includes('trident');
return userAgent.toLowerCase().includes('trident');
}
2 changes: 1 addition & 1 deletion projects/cdk/utils/browser/is-edge-older-than.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export function isEdgeOlderThan(version: number, userAgent: string): boolean {
const EDGE = 'edge/';
const currentVersion = parseInt(
userAgent.slice(userAgent.indexOf(EDGE) + EDGE.length),
userAgent.slice(userAgent.toLowerCase().indexOf(EDGE) + EDGE.length),
10,
);

Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/utils/browser/is-edge.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function isEdge(userAgent: string): boolean {
return userAgent.includes('edge');
return userAgent.toLowerCase().includes('edge');
}
2 changes: 1 addition & 1 deletion projects/cdk/utils/browser/is-firefox.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export function isFirefox(userAgent: string): boolean {
return userAgent.includes('firefox');
return userAgent.toLowerCase().includes('firefox');
}
1 change: 1 addition & 0 deletions projects/cdk/utils/browser/test/browsers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ describe('Browsers', () => {

it('isFirefox', () => {
expect(isFirefox('firefox')).toBe(true);
expect(isFirefox('Firefox')).toBe(true);
});

it('isEdgeOlderThan', () => {
Expand Down

0 comments on commit 8e9c7a4

Please sign in to comment.