Falko Schindler 2 gadi atpakaļ
vecāks
revīzija
7bf214ef7d
3 mainītis faili ar 15 papildinājumiem un 15 dzēšanām
  1. 0 1
      nicegui/functions/timer.py
  2. 0 14
      tests/test_element.py
  3. 15 0
      tests/test_timer.py

+ 0 - 1
nicegui/functions/timer.py

@@ -76,7 +76,6 @@ class Timer:
         '''Wait for the client handshake before the timer callback can can be allowed to manipulate the state.
         '''Wait for the client handshake before the timer callback can can be allowed to manipulate the state.
         See https://github.com/zauberzeug/nicegui/issues/206 for details.
         See https://github.com/zauberzeug/nicegui/issues/206 for details.
         '''
         '''
-
         if not self.slot.parent.client.shared:
         if not self.slot.parent.client.shared:
             await self.slot.parent.client.handshake()
             await self.slot.parent.client.handshake()
 
 

+ 0 - 14
tests/test_element.py

@@ -1,4 +1,3 @@
-import pytest
 from selenium.webdriver.common.by import By
 from selenium.webdriver.common.by import By
 
 
 from nicegui import ui
 from nicegui import ui
@@ -127,16 +126,3 @@ def test_remove_and_clear(screen: Screen):
     screen.should_not_contain('Label A')
     screen.should_not_contain('Label A')
     screen.should_not_contain('Label B')
     screen.should_not_contain('Label B')
     screen.should_not_contain('Label C')
     screen.should_not_contain('Label C')
-
-
-@pytest.mark.parametrize('once', [True, False])
-def test_setting_visibility_in_timer(screen: Screen, once: bool):
-    '''reproduction of https://github.com/zauberzeug/nicegui/issues/206'''
-    @ui.page('/')
-    def page():
-        label = ui.label('Some Label')
-        ui.timer(0.1, lambda: label.set_visibility(False), once=once)
-
-    screen.open('/')
-    screen.wait(0.5)
-    screen.should_not_contain('Some Label')

+ 15 - 0
tests/test_timer.py

@@ -1,3 +1,5 @@
+import pytest
+
 from nicegui import ui
 from nicegui import ui
 
 
 from .screen import Screen
 from .screen import Screen
@@ -43,3 +45,16 @@ def test_timer_on_private_page(screen: Screen):
     count = counter.value
     count = counter.value
     screen.wait(0.5)
     screen.wait(0.5)
     assert counter.value == count, 'timer is not running anymore after closing the page'
     assert counter.value == count, 'timer is not running anymore after closing the page'
+
+
+@pytest.mark.parametrize('once', [True, False])
+def test_setting_visibility(screen: Screen, once: bool):
+    '''reproduction of https://github.com/zauberzeug/nicegui/issues/206'''
+    @ui.page('/')
+    def page():
+        label = ui.label('Some Label')
+        ui.timer(0.1, lambda: label.set_visibility(False), once=once)
+
+    screen.open('/')
+    screen.wait(0.5)
+    screen.should_not_contain('Some Label')