don't add new parameter

This commit is contained in:
Will McGugan
2024-11-20 18:44:07 +00:00
parent db7d1550e9
commit 406766b6b5
3 changed files with 7 additions and 7 deletions

View File

@@ -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

View File

@@ -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:

View File

@@ -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