Falko Schindler 2 anos atrás
pai
commit
f533a8bd57
1 arquivos alterados com 29 adições e 0 exclusões
  1. 29 0
      tests/test_tailwind.py

+ 29 - 0
tests/test_tailwind.py

@@ -0,0 +1,29 @@
+from nicegui import Tailwind, ui
+
+from .screen import Screen
+
+
+def test_tailwind_builder(screen: Screen):
+    ui.label('A').tailwind('bg-red-500', 'text-white')
+
+    screen.open('/')
+    assert screen.find('A').get_attribute('class') == 'bg-red-500 text-white'
+
+
+def test_tailwind_call(screen: Screen):
+    ui.label('A').tailwind('bg-red-500 text-white')
+
+    screen.open('/')
+    assert screen.find('A').get_attribute('class') == 'bg-red-500 text-white'
+
+
+def test_tailwind_apply(screen: Screen):
+    style = Tailwind().background_color('red-500').text_color('white')
+
+    ui.label('A').tailwind(style)
+    b = ui.label('B')
+    style.apply(b)
+
+    screen.open('/')
+    assert screen.find('A').get_attribute('class') == 'bg-red-500 text-white'
+    assert screen.find('B').get_attribute('class') == 'bg-red-500 text-white'