From d4ae9aa501ece99ea6c5e6b8fb01c3005f5b7f03 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 2 May 2020 13:05:43 -0400 Subject: DOMTextScanner (#458) * Create new class for scanning text in a document * Update test styles * Add tests --- test/data/html/test-stylesheet.css | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'test/data/html/test-stylesheet.css') diff --git a/test/data/html/test-stylesheet.css b/test/data/html/test-stylesheet.css index f63d2481..2e9a2f52 100644 --- a/test/data/html/test-stylesheet.css +++ b/test/data/html/test-stylesheet.css @@ -28,7 +28,9 @@ a, a:visited { text-decoration: underline; } -.test { +.test, +y-test { + display: block; background-color: #ffffff; margin: 1em 0; padding: 0.5em; @@ -36,7 +38,8 @@ a, a:visited { border-radius: 4px; } -.test:before { +.test:before, +y-test:before { content: "Test " counter(test-id); display: block; counter-increment: test-id; @@ -45,7 +48,10 @@ a, a:visited { font-weight: bold; } -.description { +.description, +y-description { color: #444444; font-style: italic; + display: block; + padding-bottom: 0.5em; } -- cgit v1.2.3 From f85508a25edb49de96bebb77a5832931f0819eff Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 10 May 2020 14:09:04 -0400 Subject: Simplify shadow test and add an open shadow DOM test (#533) --- test/data/html/test-document2-frame1.html | 6 +- test/data/html/test-document2-script.js | 24 +++++++ test/data/html/test-document2.html | 106 ++++++++++++++---------------- test/data/html/test-stylesheet.css | 3 +- 4 files changed, 76 insertions(+), 63 deletions(-) (limited to 'test/data/html/test-stylesheet.css') diff --git a/test/data/html/test-document2-frame1.html b/test/data/html/test-document2-frame1.html index 3b85cdc5..e572e3c4 100644 --- a/test/data/html/test-document2-frame1.html +++ b/test/data/html/test-document2-frame1.html @@ -33,10 +33,8 @@ a, a:visited { ありがとう
- Toggle fullscreen - + 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 index bd5a570d..ab516a4e 100644 --- a/test/data/html/test-document2-script.js +++ b/test/data/html/test-document2-script.js @@ -39,3 +39,27 @@ function toggleFullscreen(element) { requestFullscreen(element); } } + +function setup(container, fullscreenElement=null) { + const fullscreenLink = container.querySelector('.fullscreen-link'); + if (fullscreenLink !== null) { + if (fullscreenElement === null) { + fullscreenElement = container.querySelector('.fullscreen-element'); + } + fullscreenLink.addEventListener('click', (e) => { + toggleFullscreen(fullscreenElement); + e.preventDefault(); + return false; + }, false); + } + + const template = container.querySelector('template'); + const templateContentContainer = container.querySelector('.template-content-container'); + if (template !== null && templateContentContainer !== null) { + const mode = container.dataset.shadowMode; + const shadow = templateContentContainer.attachShadow({mode}); + const content = document.importNode(template.content, true); + setup(content); + shadow.appendChild(content); + } +} diff --git a/test/data/html/test-document2.html b/test/data/html/test-document2.html index b2046dfd..6d174571 100644 --- a/test/data/html/test-document2.html +++ b/test/data/html/test-document2.html @@ -11,88 +11,78 @@

Yomichan Manual Tests

-

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

+ Manual tests involving fullscreen elements, <iframe>s, and shadow DOMs. -
-
Standard content.
-
+ + Standard content. +
ありがとう
- -
+ -
-
Content inside of a shadow DOM.
-
-