Skip to content

Commit 3413c3d

Browse files
committed
Increase steps duration & make width, height 100%
* height and width 100% * feat: add querySelectorAllInShadowRoot method for shadow DOM element selection * feat: add functionality to click all "show more" buttons in shadow DOM during tests
1 parent d3d970d commit 3413c3d

File tree

7 files changed

+257
-22
lines changed

7 files changed

+257
-22
lines changed

experimental/responsive-design/dist/index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Cooking with Lit and Tailwind</title>
7+
<style>
8+
body,
9+
html {
10+
margin: 0;
11+
width: 100%;
12+
height: 100%;
13+
overflow: hidden;
14+
}
15+
#content-iframe {
16+
width: 100%;
17+
height: 100%;
18+
border: none;
19+
}
20+
</style>
721
</head>
8-
<body style="overflow: hidden; margin: 0">
9-
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html" width="800px" height="600px" style="border: none"></iframe>
22+
<body>
23+
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html"></iframe>
1024
</body>
1125
</html>

experimental/responsive-design/index.html

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,22 @@
44
<meta charset="UTF-8" />
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<title>Cooking with Lit and Tailwind</title>
7+
<style>
8+
body,
9+
html {
10+
margin: 0;
11+
width: 100%;
12+
height: 100%;
13+
overflow: hidden;
14+
}
15+
#content-iframe {
16+
width: 100%;
17+
height: 100%;
18+
border: none;
19+
}
20+
</style>
721
</head>
8-
<body style="overflow: hidden; margin: 0">
9-
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html" width="800px" height="600px" style="border: none"></iframe>
22+
<body>
23+
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html"></iframe>
1024
</body>
1125
</html>

experimental/responsive-design/package-lock.json

Lines changed: 182 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

experimental/responsive-design/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"test": "echo \"Error: no test specified\" && exit 1"
2828
},
2929
"dependencies": {
30-
"lit": "^3.1.4"
30+
"lit": "^3.2.1"
3131
},
3232
"devDependencies": {
3333
"@rollup/plugin-html": "^1.0.4",
@@ -43,6 +43,7 @@
4343
"rollup-plugin-copy": "^3.5.0",
4444
"rollup-plugin-import-css": "^3.5.6",
4545
"rollup-plugin-postcss": "^4.0.2",
46+
"rollup-plugin-summary": "^3.0.0",
4647
"tailwindcss": "^3.4.14"
4748
}
4849
}

experimental/responsive-design/rollup.config.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import terser from "@rollup/plugin-terser";
33
import copy from "rollup-plugin-copy";
44
import css from "rollup-plugin-import-css";
55
import html from "@rollup/plugin-html";
6+
import summary from "rollup-plugin-summary";
67
import path from "path";
78
import fs from "fs";
89

@@ -19,12 +20,6 @@ export default {
1920
plugins: [
2021
resolve(),
2122
css(),
22-
copy({
23-
targets: [
24-
{ src: "index.html", dest: "dist/" },
25-
{ src: "public/", dest: "dist/" },
26-
],
27-
}),
2823
html({
2924
template: () => {
3025
const imagesDir = path.resolve("public", "images");
@@ -51,5 +46,12 @@ export default {
5146
},
5247
fileName: "iframe.html",
5348
}),
49+
summary(),
50+
copy({
51+
targets: [
52+
{ src: "index.html", dest: "dist/" },
53+
{ src: "public/", dest: "dist/" },
54+
],
55+
}),
5456
],
5557
};

resources/benchmark-runner.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ class PageElement {
150150
}
151151

152152
setWidth(width) {
153-
this.#node.width = width;
153+
this.#node.style.width = width;
154154
}
155155

156156
scrollIntoView() {
@@ -215,6 +215,14 @@ class PageElement {
215215
return new PageElement(element);
216216
}
217217

218+
querySelectorAllInShadowRoot(selector, path = []) {
219+
const lookupStartNode = this.#node.shadowRoot ?? this.#node;
220+
const elements = Array.from(getParent(lookupStartNode, path).querySelectorAll(selector));
221+
for (let i = 0; i < elements.length; i++)
222+
elements[i] = new PageElement(elements[i]);
223+
return elements;
224+
}
225+
218226
querySelector(selector) {
219227
const element = this.#node.querySelector(selector);
220228

0 commit comments

Comments
 (0)