-
Notifications
You must be signed in to change notification settings - Fork 114
tests(accordion): Add kitchensink tests for accordion #1710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2b5c77b
Add kitchensink tests for accordion
karangattu 42205e8
Update test_accordion.py
karangattu 153182e
add pyright ignore
karangattu 978f8b2
Rename value to exists. Fix unexpected test behavior
schloerke c9a77d0
Apply suggestions from code review
schloerke 75ce322
Merge branch 'main' into add_accordion_kitchensink_tests
schloerke aa8640d
Add CHANGELOG
karangattu 6665cf3
remove comment
karangattu 64deb41
Merge branch 'main' into add_accordion_kitchensink_tests
schloerke 6042491
Remove `expect_class(*, has_class=)` parameter
schloerke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
46 changes: 46 additions & 0 deletions
46
tests/playwright/shiny/inputs/accordion_kitchensink/app.py
This file contains hidden or 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,46 @@ | ||
from faicons import icon_svg | ||
|
||
from shiny import App, Inputs, ui | ||
|
||
app_ui = ui.page_fluid( | ||
ui.h1("Accordion Kitchensink"), | ||
ui.accordion( | ||
ui.accordion_panel( | ||
"Panel 1", | ||
ui.p("This is the content of Panel 1"), | ||
value="panel1", | ||
), | ||
ui.accordion_panel( | ||
"Panel 2", | ||
ui.p("This is the content of Panel 2"), | ||
icon=icon_svg("trash-arrow-up"), | ||
value="panel2", | ||
), | ||
id="accordion_1", | ||
width="600px", | ||
height="300px", | ||
multiple=False, | ||
class_="bg-light", | ||
), | ||
ui.accordion( | ||
ui.accordion_panel( | ||
"Panel 3", | ||
ui.p("This is the content of Panel 3"), | ||
value="panel3", | ||
), | ||
ui.accordion_panel( | ||
"Panel 4", | ||
ui.p("This is the content of Panel 4"), | ||
value="panel4", | ||
), | ||
id="accordion_2", | ||
multiple=True, | ||
), | ||
) | ||
|
||
|
||
def server(input: Inputs): | ||
pass | ||
|
||
|
||
app = App(app_ui, server) |
40 changes: 40 additions & 0 deletions
40
tests/playwright/shiny/inputs/accordion_kitchensink/test_accordion_kitchensink.py
This file contains hidden or 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 playwright.sync_api import Page | ||
|
||
from shiny.playwright import controller | ||
from shiny.run import ShinyAppProc | ||
|
||
|
||
def test_accordion_kitchensink(page: Page, local_app: ShinyAppProc) -> None: | ||
page.goto(local_app.url) | ||
|
||
accordion1 = controller.Accordion(page, "accordion_1") | ||
accordion1.expect_width("600px") | ||
accordion1.expect_height("300px") | ||
accordion1.expect_class("bg-light") | ||
accordion1.expect_multiple(False) | ||
accordion1_panel1 = accordion1.accordion_panel("panel1") | ||
accordion1_panel1.expect_open(True) | ||
accordion1_panel1.expect_label("Panel 1") | ||
accordion1_panel1.expect_icon(False) | ||
|
||
accordion1_panel2 = accordion1.accordion_panel("panel2") | ||
accordion1_panel2.expect_open(False) | ||
accordion1_panel2.expect_label("Panel 2") | ||
accordion1_panel2.expect_icon(True) | ||
accordion1_panel2.set(True) | ||
accordion1_panel2.expect_open(True) | ||
accordion1_panel1.expect_open(False) | ||
|
||
accordion2 = controller.Accordion(page, "accordion_2") | ||
accordion2.expect_width(None) | ||
accordion2.expect_height(None) | ||
accordion2.expect_multiple(True) | ||
|
||
accordion2_panel3 = accordion2.accordion_panel("panel3") | ||
accordion2_panel3.expect_open(True) | ||
|
||
accordion2_panel4 = accordion2.accordion_panel("panel4") | ||
accordion2_panel4.expect_open(False) | ||
accordion2_panel4.set(True) | ||
accordion2_panel4.expect_open(True) | ||
accordion2_panel3.expect_open(True) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.