소스 검색

#206: experimenting fix by waiting for handshake

Rodja Trappe 2 년 전
부모
커밋
2430635f64
2개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 0
      nicegui/functions/timer.py
  2. 3 2
      tests/test_element.py

+ 2 - 0
nicegui/functions/timer.py

@@ -49,6 +49,8 @@ class Timer:
             while True:
                 if self.slot.parent.client.id not in globals.clients:
                     break
+                if not self.slot.parent.client.shared:
+                    await self.slot.parent.client.handshake()
                 try:
                     start = time.time()
                     if self.active:

+ 3 - 2
tests/test_element.py

@@ -139,6 +139,7 @@ def test_setting_visibility_in_timer(screen: Screen):
         ui.timer(1, lambda: label.set_visibility(False))
 
     screen.open('/')
-    assert not label.visible
-    assert 'hidden' in label._classes
+    # assert not label.visible
+    # assert 'hidden' in label._classes
+    screen.wait(0.5)
     screen.should_not_contain('Some Label')