mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Merge pull request #1555 from Textualize/rodrigogiraoserrao-patch-1
Fix tests: await all mounts before checking rendered values
This commit is contained in:
@@ -42,8 +42,8 @@ async def test_input_value_visible_if_mounted_later():
|
|||||||
class MyApp(App):
|
class MyApp(App):
|
||||||
BINDINGS = [("a", "add_input", "add_input")]
|
BINDINGS = [("a", "add_input", "add_input")]
|
||||||
|
|
||||||
def action_add_input(self):
|
async def action_add_input(self):
|
||||||
self.mount(Input(value="value"))
|
await self.mount(Input(value="value"))
|
||||||
|
|
||||||
app = MyApp()
|
app = MyApp()
|
||||||
async with app.run_test() as pilot:
|
async with app.run_test() as pilot:
|
||||||
@@ -60,9 +60,9 @@ async def test_input_value_visible_if_mounted_later_and_focused():
|
|||||||
class MyApp(App):
|
class MyApp(App):
|
||||||
BINDINGS = [("a", "add_input", "add_input")]
|
BINDINGS = [("a", "add_input", "add_input")]
|
||||||
|
|
||||||
def action_add_input(self):
|
async def action_add_input(self):
|
||||||
inp = Input(value="value")
|
inp = Input(value="value")
|
||||||
self.mount(inp)
|
await self.mount(inp)
|
||||||
inp.focus()
|
inp.focus()
|
||||||
|
|
||||||
app = MyApp()
|
app = MyApp()
|
||||||
@@ -83,8 +83,8 @@ async def test_input_value_visible_if_mounted_later_and_assigned_after():
|
|||||||
("v", "set_value", "set_value"),
|
("v", "set_value", "set_value"),
|
||||||
]
|
]
|
||||||
|
|
||||||
def action_add_input(self):
|
async def action_add_input(self):
|
||||||
self.mount(Input())
|
await self.mount(Input())
|
||||||
|
|
||||||
def action_set_value(self):
|
def action_set_value(self):
|
||||||
self.query_one(Input).value = "value"
|
self.query_one(Input).value = "value"
|
||||||
|
|||||||
Reference in New Issue
Block a user