Skip to content

Commit e4fea42

Browse files
committed
Updating tests
1 parent 88a9fee commit e4fea42

File tree

12 files changed

+19
-81
lines changed

12 files changed

+19
-81
lines changed

tests/playwright/shiny/bugs/2061-css-js-inclusion/app.py

Lines changed: 0 additions & 38 deletions
This file was deleted.

tests/playwright/shiny/bugs/2061-css-js-inclusion/css/style.css

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/app.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,24 @@
22

33
from shiny import App, Inputs, Outputs, Session, ui
44

5-
js_file = Path(__file__).parent / "js" / "customjs.js"
6-
css_file = Path(__file__).parent / "css" / "style.css"
5+
custom_css = ui.include_css(
6+
Path(__file__).parent / "css" / "style.css",
7+
method="link_files",
8+
)
9+
10+
custom_js = ui.include_js(
11+
Path(__file__).parent / "js" / "customjs.js",
12+
method="link_files",
13+
)
14+
15+
# path where the JS file's parent directory is mounted
16+
href = custom_js.get_dependencies()[0].source_path_map()["href"]
717

818
# Define the UI
919
app_ui = ui.page_fluid(
10-
ui.include_css(css_file, method="link_files"),
11-
ui.include_js(js_file, method="link_files"),
20+
custom_css,
21+
custom_js,
22+
ui.tags.script(src=href + "/customjs2.js"),
1223
ui.h1("Simple Shiny App with External CSS"),
1324
ui.div(
1425
ui.p("This is a simple Shiny app that demonstrates ui.include_css()"),

tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/css/evenmorecss/more.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/css/style.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
@import url("./evenmorecss/more.css");
2-
31
body {
42
font-family: Arial, sans-serif;
53
}
@@ -17,5 +15,3 @@ h1 {
1715
border-radius: 5px;
1816
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
1917
}
20-
21-
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
const newParagraph = document.createElement('p');
22
newParagraph.textContent = 'Heyo!';
33
document.body.appendChild(newParagraph);
4-

tests/playwright/shiny/bugs/2061-css-js-inclusion/js/customjs2.js renamed to tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/js/customjs2.js

File renamed without changes.

tests/playwright/shiny/bugs/2061-css-js-inclusion/include_files_case/test_css-js-inclusion.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
def test_inclusion(page: Page, local_app: ShinyAppProc) -> None:
77
page.goto(local_app.url)
88

9-
expect(page.locator("body > p")).to_have_text("Heyo!")
9+
expect(page.locator("body > p").first).to_have_text("Heyo!")
10+
expect(page.locator("body > p").last).to_have_text("Also here!")

tests/playwright/shiny/bugs/2061-css-js-inclusion/js/customjs.js

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
const newParagraph = document.createElement('p');
22
newParagraph.textContent = 'Heyo!';
33
document.body.appendChild(newParagraph);
4+

0 commit comments

Comments
 (0)