Skip to content

Commit

Permalink
Increase steps duration & make width, height 100%
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
issackjohn authored Dec 6, 2024
1 parent 2525f91 commit cd96d0b
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 22 deletions.
18 changes: 16 additions & 2 deletions experimental/responsive-design/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cooking with Lit and Tailwind</title>
<style>
body,
html {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
#content-iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<body style="overflow: hidden; margin: 0">
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html" width="800px" height="600px" style="border: none"></iframe>
<body>
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html"></iframe>
</body>
</html>
18 changes: 16 additions & 2 deletions experimental/responsive-design/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,22 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Cooking with Lit and Tailwind</title>
<style>
body,
html {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
}
#content-iframe {
width: 100%;
height: 100%;
border: none;
}
</style>
</head>
<body style="overflow: hidden; margin: 0">
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html" width="800px" height="600px" style="border: none"></iframe>
<body>
<iframe title="Cooking Website with Recipes" id="content-iframe" src="iframe.html"></iframe>
</body>
</html>
183 changes: 182 additions & 1 deletion experimental/responsive-design/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion experimental/responsive-design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"test": "echo \"Error: no test specified\" && exit 1"
},
"dependencies": {
"lit": "^3.1.4"
"lit": "^3.2.1"
},
"devDependencies": {
"@rollup/plugin-html": "^1.0.4",
Expand All @@ -43,6 +43,7 @@
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-import-css": "^3.5.6",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-summary": "^3.0.0",
"tailwindcss": "^3.4.14"
}
}
14 changes: 8 additions & 6 deletions experimental/responsive-design/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import terser from "@rollup/plugin-terser";
import copy from "rollup-plugin-copy";
import css from "rollup-plugin-import-css";
import html from "@rollup/plugin-html";
import summary from "rollup-plugin-summary";
import path from "path";
import fs from "fs";

Expand All @@ -19,12 +20,6 @@ export default {
plugins: [
resolve(),
css(),
copy({
targets: [
{ src: "index.html", dest: "dist/" },
{ src: "public/", dest: "dist/" },
],
}),
html({
template: () => {
const imagesDir = path.resolve("public", "images");
Expand All @@ -51,5 +46,12 @@ export default {
},
fileName: "iframe.html",
}),
summary(),
copy({
targets: [
{ src: "index.html", dest: "dist/" },
{ src: "public/", dest: "dist/" },
],
}),
],
};
10 changes: 9 additions & 1 deletion resources/benchmark-runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class PageElement {
}

setWidth(width) {
this.#node.width = width;
this.#node.style.width = width;
}

scrollIntoView() {
Expand Down Expand Up @@ -215,6 +215,14 @@ class PageElement {
return new PageElement(element);
}

querySelectorAllInShadowRoot(selector, path = []) {
const lookupStartNode = this.#node.shadowRoot ?? this.#node;
const elements = Array.from(getParent(lookupStartNode, path).querySelectorAll(selector));
for (let i = 0; i < elements.length; i++)
elements[i] = new PageElement(elements[i]);
return elements;
}

querySelector(selector) {
const element = this.#node.querySelector(selector);

Expand Down
Loading

0 comments on commit cd96d0b

Please sign in to comment.