Makes Runtime.js detect the generalized ForemWebView User Agent (#11288)
* Makes Runtime.js detect the generalized ForemWebView User Agent extension * Adds tests
This commit is contained in:
parent
ec5d0d0d93
commit
f11523f29a
2 changed files with 12 additions and 3 deletions
|
|
@ -17,7 +17,7 @@ class Runtime {
|
|||
*/
|
||||
static isNativeIOS(namespace = null) {
|
||||
const nativeCheck =
|
||||
/DEV-Native-ios|forem-native-ios/i.test(navigator.userAgent) &&
|
||||
/DEV-Native-ios|ForemWebView/i.test(navigator.userAgent) &&
|
||||
window &&
|
||||
window.webkit &&
|
||||
window.webkit.messageHandlers;
|
||||
|
|
@ -40,7 +40,7 @@ class Runtime {
|
|||
*/
|
||||
static isNativeAndroid(namespace = null) {
|
||||
const nativeCheck =
|
||||
/DEV-Native-android|forem-native-android/i.test(navigator.userAgent) &&
|
||||
/DEV-Native-android|ForemWebView/i.test(navigator.userAgent) &&
|
||||
AndroidBridge != undefined;
|
||||
|
||||
let namespaceCheck = true;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,19 @@
|
|||
require "rails_helper"
|
||||
|
||||
RSpec.describe "User visits podcast show page", type: :system do
|
||||
RSpec.describe "User visits podcast show page", type: :system, js: true do
|
||||
let(:podcast) { create(:podcast) }
|
||||
let(:podcast_episode) { create(:podcast_episode, podcast_id: podcast.id) }
|
||||
let(:single_quote_episode) { create(:podcast_episode, title: "What's up doc?!") }
|
||||
|
||||
it "doesn't detect native capabilities from a non-mobile web browser" do
|
||||
visit podcast_episode.path.to_s
|
||||
|
||||
result = execute_script("return Runtime.isNativeIOS('podcast')")
|
||||
expect(result).to be false
|
||||
result = execute_script("return Runtime.isNativeAndroid('podcast')")
|
||||
expect(result).to be false
|
||||
end
|
||||
|
||||
it "they see the content of the hero", js: true, retry: 3 do
|
||||
visit podcast_episode.path.to_s
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue