mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
don't add new parameter
This commit is contained in:
@@ -11,7 +11,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Added
|
||||
|
||||
- Added Styles.has_any_rules https://github.com/Textualize/textual/pull/5264
|
||||
- Added `active_effect_duration` to `Button.__init__` https://github.com/Textualize/textual/pull/5267
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -204,7 +204,6 @@ class Button(Widget, can_focus=True):
|
||||
disabled: Whether the button is disabled or not.
|
||||
tooltip: Optional tooltip.
|
||||
action: Optional action to run when clicked.
|
||||
active_effect_duration: Amount of time in seconds the button 'press' animation lasts.
|
||||
"""
|
||||
super().__init__(name=name, id=id, classes=classes, disabled=disabled)
|
||||
|
||||
@@ -214,7 +213,7 @@ class Button(Widget, can_focus=True):
|
||||
self.label = label
|
||||
self.variant = variant
|
||||
self.action = action
|
||||
self.active_effect_duration = active_effect_duration
|
||||
self.active_effect_duration = 0.2
|
||||
"""Amount of time in seconds the button 'press' animation lasts."""
|
||||
|
||||
if tooltip is not None:
|
||||
|
||||
@@ -452,7 +452,7 @@ async def test_loading_button():
|
||||
|
||||
class LoadingApp(App):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Button("Hello, World", action="app.inc", active_effect_duration=0)
|
||||
yield Button("Hello, World", action="app.inc")
|
||||
|
||||
def action_inc(self) -> None:
|
||||
nonlocal counter
|
||||
@@ -462,16 +462,18 @@ async def test_loading_button():
|
||||
# Sanity check
|
||||
assert counter == 0
|
||||
|
||||
button = pilot.app.query_one(Button)
|
||||
button.active_effect_duration = 0
|
||||
|
||||
# Click the button to advance the counter
|
||||
await pilot.click(Button)
|
||||
await pilot.click(button)
|
||||
assert counter == 1
|
||||
|
||||
# Set the button to loading state
|
||||
button = pilot.app.query_one(Button)
|
||||
button.loading = True
|
||||
|
||||
# A click should do nothing
|
||||
await pilot.click(Button)
|
||||
await pilot.click(button)
|
||||
assert counter == 1
|
||||
|
||||
# Set the button to not loading
|
||||
|
||||
Reference in New Issue
Block a user