-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add short circuit to allow popups in supported browsers
- Loading branch information
Showing
3 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
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,22 @@ | ||
/* @flow */ | ||
import { describe, test, expect } from "vitest"; | ||
|
||
import { supportsPopups, isPopupSupportedWebview } from "./device"; | ||
|
||
describe("supportsPopups", () => { | ||
test("returns true when short circuited", () => { | ||
const ua = `Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) | ||
AppleWebKit/537.36 (KHTML, like Gecko) | ||
Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/44.25.0.1;FB/MW]`; | ||
expect(supportsPopups(ua)).toBe(true); | ||
}); | ||
}); | ||
|
||
describe("isPopupSupportedWebview", () => { | ||
test("returns true when fb webview supported user agent", () => { | ||
const ua = `Mozilla/5.0 (Linux; Android 5.1.1; Nexus 5 Build/LMY48B; wv) | ||
AppleWebKit/537.36 (KHTML, like Gecko) | ||
Version/4.0 Chrome/43.0.2357.65 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/44.25.0.1;FB/MW]`; | ||
expect(isPopupSupportedWebview(ua)).toBe(true); | ||
}); | ||
}); |
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