diff --git a/.eslintrc.json b/.eslintrc.json index db8ff1fa..9bd6514a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -106,6 +106,7 @@ }, { "files": ["test/**/*.js"], + "excludedFiles": ["test/data/html/*.js"], "parserOptions": { "ecmaVersion": 8, "sourceType": "module" diff --git a/test/data/html/test-document2-frame1.html b/test/data/html/test-document2-frame1.html new file mode 100644 index 00000000..3b85cdc5 --- /dev/null +++ b/test/data/html/test-document2-frame1.html @@ -0,0 +1,42 @@ + + + + + + Yomichan Tests + + + +
+
+ ありがとう +
+
+ Toggle fullscreen + +
+
+ \ No newline at end of file diff --git a/test/data/html/test-document2-script.js b/test/data/html/test-document2-script.js new file mode 100644 index 00000000..bd5a570d --- /dev/null +++ b/test/data/html/test-document2-script.js @@ -0,0 +1,41 @@ +function requestFullscreen(element) { + if (element.requestFullscreen) { + element.requestFullscreen(); + } else if (element.mozRequestFullScreen) { + element.mozRequestFullScreen(); + } else if (element.webkitRequestFullscreen) { + element.webkitRequestFullscreen(); + } else if (element.msRequestFullscreen) { + element.msRequestFullscreen(); + } +} + +function exitFullscreen() { + if (document.exitFullscreen) { + document.exitFullscreen(); + } else if (document.mozCancelFullScreen) { + document.mozCancelFullScreen(); + } else if (document.webkitExitFullscreen) { + document.webkitExitFullscreen(); + } else if (document.msExitFullscreen) { + document.msExitFullscreen(); + } +} + +function getFullscreenElement() { + return ( + document.fullscreenElement || + document.msFullscreenElement || + document.mozFullScreenElement || + document.webkitFullscreenElement || + null + ); +} + +function toggleFullscreen(element) { + if (getFullscreenElement()) { + exitFullscreen(); + } else { + requestFullscreen(element); + } +} diff --git a/test/data/html/test-document2.html b/test/data/html/test-document2.html new file mode 100644 index 00000000..0561a176 --- /dev/null +++ b/test/data/html/test-document2.html @@ -0,0 +1,81 @@ + + + + + + Yomichan Manual Tests + + + + + + +

Yomichan Manual Tests

+

Manual tests involving fullscreen elements, <iframe>s, and shadow DOMs.

+ +
+
Standard content.
+
+
+ ありがとう +
+
+ Toggle fullscreen +
+
+ +
+ +
+
Content inside of a shadow DOM.
+
+ + +
+ +
+
<iframe> element.
+ +
+ +
+
<iframe> element inside of a shadow DOM.
+
+ + +
+ + + \ No newline at end of file diff --git a/test/data/html/test-stylesheet.css b/test/data/html/test-stylesheet.css index ab25732e..f63d2481 100644 --- a/test/data/html/test-stylesheet.css +++ b/test/data/html/test-stylesheet.css @@ -7,6 +7,7 @@ body { margin: 0 auto; background-color: #f8f8f8; counter-reset: test-id; + overflow-y: scroll; } h1 { @@ -14,6 +15,19 @@ h1 { margin: 0.67em 0; } +p { + margin: 0.33em 0; +} + +h1+p { + margin-top: -0.67em; +} + +a, a:visited { + color: #1080c0; + text-decoration: underline; +} + .test { background-color: #ffffff; margin: 1em 0; @@ -30,3 +44,8 @@ h1 { border-bottom: 1px solid #d8d8d8; font-weight: bold; } + +.description { + color: #444444; + font-style: italic; +}