summaryrefslogtreecommitdiff
path: root/app/src/test/java/org/terst/feedreader
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/test/java/org/terst/feedreader')
-rw-r--r--app/src/test/java/org/terst/feedreader/ui/YouTubeLinksTest.kt29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/src/test/java/org/terst/feedreader/ui/YouTubeLinksTest.kt b/app/src/test/java/org/terst/feedreader/ui/YouTubeLinksTest.kt
index af9884d..d2c623c 100644
--- a/app/src/test/java/org/terst/feedreader/ui/YouTubeLinksTest.kt
+++ b/app/src/test/java/org/terst/feedreader/ui/YouTubeLinksTest.kt
@@ -127,4 +127,33 @@ class YouTubeLinksTest {
fun `the watch link for a video is the one a phone can hand to the YouTube app`() {
assertEquals("https://www.youtube.com/watch?v=dQw4w9WgXcQ", youTubeWatchUrl("dQw4w9WgXcQ"))
}
+
+ // --- giving the player a height -------------------------------------------------------
+
+ @Test
+ fun `the fit script sizes the player from the height the page does know`() {
+ val js = YOUTUBE_FIT_PLAYER_JS
+
+ assertTrue("percentage heights are what resolve to zero: $js", js.contains("window.innerHeight"))
+ assertTrue(js.contains("dispatchEvent"))
+ }
+
+ @Test
+ fun `the fit script overrides YouTube's own styles, which would otherwise win`() {
+ assertTrue(YOUTUBE_FIT_PLAYER_JS.contains("!important"))
+ }
+
+ @Test
+ fun `the fit script covers the video element and the containers above it`() {
+ val js = YOUTUBE_FIT_PLAYER_JS
+
+ assertTrue(js.contains("html,body"))
+ assertTrue(js.contains("#movie_player"))
+ assertTrue(js.contains("video{height:"))
+ }
+
+ @Test
+ fun `the fit script does nothing when the page has no height to copy`() {
+ assertTrue("must not pin the player to zero", YOUTUBE_FIT_PLAYER_JS.contains("if (!h) { return; }"))
+ }
}