-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(input_numeric): Add kitchensink tests for more input components (…
- Loading branch information
1 parent
4f71720
commit 2e019cd
Showing
28 changed files
with
658 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
tests/playwright/shiny/inputs/input_kitchensink/input_action_button_kitchensink/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from faicons import icon_svg | ||
|
||
from shiny.express import input, render, ui | ||
|
||
ui.page_opts(title="Kitchen Sink: ui.input_action_button()", fillable=True) | ||
|
||
with ui.layout_columns(): | ||
with ui.card(): | ||
ui.h3("Default Action Button") | ||
ui.input_action_button("default", label="Default button") | ||
|
||
@render.code | ||
def default_txt(): | ||
return f"Button clicked {input.default()} times" | ||
|
||
with ui.card(): | ||
ui.h3("With Custom Width") | ||
ui.input_action_button("width", "Wide button", width="200px") | ||
|
||
@render.code | ||
def width_txt(): | ||
return f"Button clicked {input.width()} times" | ||
|
||
with ui.card(): | ||
ui.h3("With Icon") | ||
ui.input_action_button( | ||
"icon", "Button with icon", icon=icon_svg("trash-arrow-up") | ||
) | ||
|
||
@render.code | ||
def icon_txt(): | ||
return f"Button clicked {input.icon()} times" | ||
|
||
with ui.card(): | ||
ui.h3("Disabled Button") | ||
ui.input_action_button("disabled", "Disabled button", disabled=True) | ||
|
||
@render.code | ||
def disabled_txt(): | ||
return f"Button clicked {input.disabled()} times" |
27 changes: 27 additions & 0 deletions
27
...input_kitchensink/input_action_button_kitchensink/test_input_action_button_kitchensink.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from playwright.sync_api import Page | ||
from playwright.sync_api import expect as playwright_expect | ||
|
||
from shiny.playwright import controller | ||
from shiny.run import ShinyAppProc | ||
|
||
|
||
def test_input_action_button_kitchen(page: Page, local_app: ShinyAppProc) -> None: | ||
page.goto(local_app.url) | ||
|
||
default = controller.InputActionButton(page, "default") | ||
default.expect_label("Default button") | ||
default.expect_disabled(False) | ||
controller.OutputCode(page, "default_txt").expect_value("Button clicked 0 times") | ||
default.click() | ||
controller.OutputCode(page, "default_txt").expect_value("Button clicked 1 times") | ||
|
||
width = controller.InputActionButton(page, "width") | ||
width.expect_width("200px") | ||
|
||
disabled = controller.InputActionButton(page, "disabled") | ||
disabled.expect_disabled(True) | ||
# Disabled button should not have an icon | ||
playwright_expect(disabled.loc.locator("svg.fa")).to_have_count(0) | ||
|
||
icon = controller.InputActionButton(page, "icon") | ||
playwright_expect(icon.loc.locator("svg.fa")).to_have_count(1) |
20 changes: 20 additions & 0 deletions
20
tests/playwright/shiny/inputs/input_kitchensink/input_action_link_kitchensink/app.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from faicons import icon_svg | ||
|
||
from shiny.express import input, render, ui | ||
|
||
ui.page_opts(title="Kitchen Sink: ui.input_action_link()", fillable=True) | ||
|
||
with ui.layout_columns(): | ||
with ui.card(): | ||
ui.input_action_link("default", label="Default action link") | ||
|
||
@render.code | ||
def default_txt(): | ||
return f"Link clicked {input.default()} times" | ||
|
||
with ui.card(): | ||
ui.input_action_link("icon", "Link with icon", icon=icon_svg("trash-arrow-up")) | ||
|
||
@render.code | ||
def icon_txt(): | ||
return f"Link clicked {input.icon()} times" |
19 changes: 19 additions & 0 deletions
19
...uts/input_kitchensink/input_action_link_kitchensink/test_input_action_link_kitchensink.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from playwright.sync_api import Page | ||
from playwright.sync_api import expect as playwright_expect | ||
|
||
from shiny.playwright import controller | ||
from shiny.run import ShinyAppProc | ||
|
||
|
||
def test_input_action_link_kitchen(page: Page, local_app: ShinyAppProc) -> None: | ||
page.goto(local_app.url) | ||
|
||
default = controller.InputActionLink(page, "default") | ||
default.expect_label("Default action link") | ||
playwright_expect(default.loc.locator("svg.fa")).to_have_count(0) | ||
controller.OutputCode(page, "default_txt").expect_value("Link clicked 0 times") | ||
default.click() | ||
controller.OutputCode(page, "default_txt").expect_value("Link clicked 1 times") | ||
|
||
icon = controller.InputActionLink(page, "icon") | ||
playwright_expect(icon.loc.locator("svg.fa")).to_have_count(1) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.