-
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.
fix(input_dark_mode): Allow users to customize
style
attribute (#1207)
- Loading branch information
Showing
3 changed files
with
30 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from htmltools import css | ||
|
||
from shiny.ui import input_dark_mode | ||
|
||
|
||
def test_input_dark_mode_style(): | ||
base = input_dark_mode() | ||
base_style = base.attrs["style"] | ||
assert isinstance(base_style, str) | ||
|
||
dark_mode = input_dark_mode(style="color: red;") | ||
assert dark_mode.attrs["style"] == base_style + " color: red;" | ||
|
||
css_position = css(position="absolute", top="1em", left="1em") | ||
assert isinstance(css_position, str) | ||
|
||
dark_mode = input_dark_mode(style=css_position) | ||
assert dark_mode.attrs["style"] == base_style + " " + css_position |