Skip to content

Commit

Permalink
add pytest and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Sep 19, 2023
1 parent da83009 commit 0d21208
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_code.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from nicegui import ui

from .screen import Screen


def test_code(screen: Screen):
ui.code('x = 42')

screen.open('/')
assert screen.find_by_class('n').text == 'x'
assert screen.find_by_class('o').text == '='
assert screen.find_by_class('mi').text == '42'
1 change: 1 addition & 0 deletions website/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def captions_and_overlays_demo():
load_demo(ui.scene)
load_demo(ui.tree)
load_demo(ui.log)
load_demo(ui.code)
load_demo(ui.json_editor)

heading('Layout')
Expand Down
11 changes: 11 additions & 0 deletions website/more_documentation/code_documentation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from nicegui import ui


def main_demo() -> None:
ui.code('''
from nicegui import ui
ui.label('Code inception!')
ui.run()
''').classes('w-full')

0 comments on commit 0d21208

Please sign in to comment.