|
@@ -36,17 +36,17 @@ def test_opening_link_in_new_tab(screen: Screen):
|
|
|
screen.should_contain('open sub-page')
|
|
|
|
|
|
|
|
|
-def test_replacing_link(screen: Screen):
|
|
|
- def change():
|
|
|
- content.clear()
|
|
|
- with content:
|
|
|
- ui.link('zauberzeug', 'https://zauberzeug.com')
|
|
|
- with ui.row() as content:
|
|
|
- ui.link('nicegui.io', 'https://nicegui.io')
|
|
|
- ui.button('change link', on_click=change)
|
|
|
+def test_replace_link(screen: Screen):
|
|
|
+ with ui.row() as container:
|
|
|
+ ui.link('nicegui.io', 'https://nicegui.io/')
|
|
|
+
|
|
|
+ def replace():
|
|
|
+ container.clear()
|
|
|
+ with container:
|
|
|
+ ui.link('zauberzeug', 'https://zauberzeug.com/')
|
|
|
+ ui.button('Replace', on_click=replace)
|
|
|
|
|
|
screen.open('/')
|
|
|
- content.clear()
|
|
|
- screen.should_not_contain('nicegui')
|
|
|
- screen.click('change link')
|
|
|
+ assert screen.find('nicegui.io').get_attribute('href') == 'https://nicegui.io/'
|
|
|
+ screen.click('Replace')
|
|
|
assert screen.find('zauberzeug').get_attribute('href') == 'https://zauberzeug.com/'
|