-
-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add default_expand_all parameter and warn when using the prop
- Loading branch information
1 parent
3465dc1
commit 6ab9204
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from nicegui import ui | ||
|
||
from .screen import Screen | ||
|
||
|
||
def test_tree(screen: Screen): | ||
ui.tree([ | ||
{'id': 'numbers', 'children': [{'id': '1'}, {'id': '2'}]}, | ||
{'id': 'letters', 'children': [{'id': 'A'}, {'id': 'B'}]}, | ||
], label_key='id') | ||
|
||
screen.open('/') | ||
screen.should_contain('numbers') | ||
screen.should_contain('letters') | ||
screen.should_not_contain('1') | ||
screen.should_not_contain('2') | ||
screen.should_not_contain('A') | ||
screen.should_not_contain('B') | ||
|
||
screen.find_by_class('q-icon').click() | ||
screen.should_contain('1') | ||
screen.should_contain('2') | ||
|
||
|
||
def test_default_expand_all(screen: Screen): | ||
ui.tree([ | ||
{'id': 'numbers', 'children': [{'id': '1'}, {'id': '2'}]}, | ||
{'id': 'letters', 'children': [{'id': 'A'}, {'id': 'B'}]}, | ||
], label_key='id', default_expand_all=True) | ||
|
||
screen.open('/') | ||
screen.should_contain('numbers') | ||
screen.should_contain('letters') | ||
screen.should_contain('1') | ||
screen.should_contain('2') | ||
screen.should_contain('A') | ||
screen.should_contain('B') |