-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_simple.py
55 lines (43 loc) · 1.27 KB
/
test_simple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import pytest,sys
from htag import Tag
def test_hflex_vflex():
clean()
import htagui.basics as ui
HBox= ui.hflex(50,50)
assert issubclass(HBox,Tag)
VBox= ui.vflex(50,50)
assert issubclass(VBox,Tag)
def test_ui_App(ui=None):
if not ui:
clean()
import htagui.basics as ui
x=ui.App()
assert isinstance( x.ui, ui.Dialog )
x.ui.alert("yolo")
assert ">yolo<" in str(x) # there is a message box in x
# assert "try{interact" in str(x),str(x) # there are js-interaction in x (to close the box)
x.ui.close()
assert ">yolo<" not in str(x) # there is NO MORE a message box in x
assert "try{interact" not in str(x) # there are NO MORE js-interaction in x (to close the box)
def test_ui_App_bulma():
clean()
import htagui.bulma as ui
test_ui_App(ui)
def test_ui_App_shoelace():
clean()
import htagui.shoelace as ui
test_ui_App(ui)
def test_ui_App_md():
clean()
import htagui.md as ui
test_ui_App(ui)
def clean():
for x in list(sys.modules.keys()):
if x.startswith("htagui"):
del sys.modules[x]
if __name__=="__main__":
test_hflex_vflex()
test_ui_App()
test_ui_App_bulma()
test_ui_App_shoelace()
test_ui_App_md()