aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-18 23:39:21 +0300
committerGitHub <noreply@github.com>2020-04-18 23:39:21 +0300
commit7a03ce0194fafb0c2e49994dc6efd33d5fdb6a07 (patch)
tree68a6bc438180e9b3871cee4755a78b18ba3fa3e1 /test
parent5b3d7fadc3534ba27eee971dac4ba5ee475c4e3d (diff)
parentd66ca93ce4d6a4c9814bac4cc508c24ff87b8f69 (diff)
Merge pull request #460 from siikamiika/iframe-popup-edge-cases
Iframe popup edge cases
Diffstat (limited to 'test')
-rw-r--r--test/data/html/test-document2.html19
-rw-r--r--test/data/html/test-document3-frame1.html44
-rw-r--r--test/data/html/test-document3-frame2.html62
-rw-r--r--test/data/html/test-document3.html26
4 files changed, 150 insertions, 1 deletions
diff --git a/test/data/html/test-document2.html b/test/data/html/test-document2.html
index 3a22a5bf..b2046dfd 100644
--- a/test/data/html/test-document2.html
+++ b/test/data/html/test-document2.html
@@ -77,5 +77,22 @@ document.querySelector('#fullscreen-link1').addEventListener('click', () => togg
</script>
</div>
+ <div class="test">
+ <div class="description">&lt;iframe&gt; element inside of an open shadow DOM.</div>
+ <div id="shadow-iframe-container-open"></div>
+ <template id="shadow-iframe-container-open-content-template">
+ <iframe src="test-document2-frame1.html" allowfullscreen="true" style="width: 100%; height: 200px; border: 1px solid #d8d8d8;"></iframe>
+ </template>
+ <script>
+(() => {
+ const shadowIframeContainer = document.querySelector('#shadow-iframe-container-open');
+ const shadow = shadowIframeContainer.attachShadow({mode: 'open'});
+ const template = document.querySelector('#shadow-iframe-container-open-content-template').content;
+ const content = document.importNode(template, true);
+ shadow.appendChild(content);
+})();
+ </script>
+ </div>
+
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/test/data/html/test-document3-frame1.html b/test/data/html/test-document3-frame1.html
new file mode 100644
index 00000000..2ae906d2
--- /dev/null
+++ b/test/data/html/test-document3-frame1.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Yomichan Manual Performance Tests</title>
+ <link rel="stylesheet" href="test-stylesheet.css" />
+ </head>
+<body><div class="content">
+
+ <div class="description">Add elements</div>
+
+ <div>
+ <a href="#" id="add-elements-1000">1000</a>
+ <a href="#" id="add-elements-10000">10000</a>
+ <a href="#" id="add-elements-100000">100000</a>
+ <a href="#" id="add-elements-1000000">1000000</a>
+ <script>
+document.querySelector('#add-elements-1000').addEventListener('click', () => addElements(1000), false);
+document.querySelector('#add-elements-10000').addEventListener('click', () => addElements(10000), false);
+document.querySelector('#add-elements-100000').addEventListener('click', () => addElements(100000), false);
+document.querySelector('#add-elements-1000000').addEventListener('click', () => addElements(1000000), false);
+
+let counter = 0;
+
+function addElements(amount) {
+ const container = document.querySelector('#container');
+ for (let i = 0; i < amount; i++) {
+ const element = document.createElement('div');
+ element.textContent = 'ありがとう';
+ container.appendChild(element);
+ }
+
+ counter += amount;
+ document.querySelector('#counter').textContent = counter;
+}
+ </script>
+ </div>
+
+ <div id="counter"></div>
+ <div id="container"></div>
+
+</div></body>
+</html>
diff --git a/test/data/html/test-document3-frame2.html b/test/data/html/test-document3-frame2.html
new file mode 100644
index 00000000..c486e04b
--- /dev/null
+++ b/test/data/html/test-document3-frame2.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Yomichan Manual Performance Tests</title>
+ <link rel="stylesheet" href="test-stylesheet.css" />
+ </head>
+<body><div class="content">
+
+ <div class="description">&lt;iframe&gt; element inside of an open shadow DOM.</div>
+
+ <div id="shadow-iframe-container-open"></div>
+ <template id="shadow-iframe-container-open-content-template">
+ <iframe src="test-document2-frame1.html" allowfullscreen="true" style="width: 100%; height: 50px; border: 1px solid #d8d8d8;"></iframe>
+ </template>
+ <script>
+(() => {
+ const shadowIframeContainer = document.querySelector('#shadow-iframe-container-open');
+ const shadow = shadowIframeContainer.attachShadow({mode: 'open'});
+ const template = document.querySelector('#shadow-iframe-container-open-content-template').content;
+ const content = document.importNode(template, true);
+ shadow.appendChild(content);
+})();
+ </script>
+
+ <div class="description">Add elements</div>
+
+ <div>
+ <a href="#" id="add-elements-1000">1000</a>
+ <a href="#" id="add-elements-10000">10000</a>
+ <a href="#" id="add-elements-100000">100000</a>
+ <a href="#" id="add-elements-1000000">1000000</a>
+ </div>
+
+ <div id="counter"></div>
+ <div id="container"></div>
+ <script>
+(() => {
+ document.querySelector('#add-elements-1000').addEventListener('click', () => addElements(1000), false);
+ document.querySelector('#add-elements-10000').addEventListener('click', () => addElements(10000), false);
+ document.querySelector('#add-elements-100000').addEventListener('click', () => addElements(100000), false);
+ document.querySelector('#add-elements-1000000').addEventListener('click', () => addElements(1000000), false);
+
+ let counter = 0;
+
+ function addElements(amount) {
+ const container = document.querySelector('#container');
+ for (let i = 0; i < amount; i++) {
+ const element = document.createElement('div');
+ element.textContent = 'ありがとう';
+ container.appendChild(element);
+ }
+
+ counter += amount;
+ document.querySelector('#counter').textContent = counter;
+ }
+})();
+ </script>
+
+</div></body>
+</html>
diff --git a/test/data/html/test-document3.html b/test/data/html/test-document3.html
new file mode 100644
index 00000000..3e7d5236
--- /dev/null
+++ b/test/data/html/test-document3.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
+ <title>Yomichan Manual Performance Tests</title>
+ <link rel="icon" type="image/gif" href="data:image/gif;base64,R0lGODlhEAAQAKEBAAAAAP///////////yH5BAEKAAIALAAAAAAQABAAAAImFI6Zpt0B4YkS0TCpq07xbmEgcGVRUpLaI46ZG7ppalY0jDCwUAAAOw==" />
+ <link rel="stylesheet" href="test-stylesheet.css" />
+ </head>
+<body>
+
+ <h1>Yomichan Manual Performance Tests</h1>
+ <p class="description">Testing Yomichan performance with artificially demanding cases in a real browser</p>
+
+ <div class="test">
+ <div class="description">&lt;iframe&gt; element.</div>
+ <iframe src="test-document3-frame1.html" allowfullscreen="true" style="width: 100%; height: 200px; border: 1px solid #d8d8d8;"></iframe>
+ </div>
+
+ <div class="test">
+ <div class="description">&lt;iframe&gt; element containing an &lt;iframe&gt; element inside of an open shadow DOM.</div>
+ <iframe src="test-document3-frame2.html" allowfullscreen="true" style="width: 100%; height: 200px; border: 1px solid #d8d8d8;"></iframe>
+ </div>
+
+</body>
+</html>