Skip to content

Commit a7cc70b

Browse files
committed
render tests for dialog
1 parent 3748dac commit a7cc70b

18 files changed

+110
-1
lines changed

tests/app.d/tests.app

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ file_2=ui.py
99
file_3=ui_render_all.py
1010
file_4=ui_flex.py
1111
file_5=ui_table.py
12-
file_6=ui_panel_loading.py
12+
file_6=ui_panel_loading.py
13+
file_7=ui_dialog.py

tests/app.d/ui_dialog.py

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
from deephaven import ui
2+
3+
my_modal = ui.panel(
4+
ui.dialog_trigger(
5+
ui.action_button(
6+
"Trigger Modal",
7+
),
8+
ui.dialog(
9+
ui.heading("Modal"),
10+
ui.content("This is a modal."),
11+
),
12+
is_dismissable=True,
13+
type="modal",
14+
default_open=True,
15+
)
16+
)
17+
18+
my_popover = ui.panel(
19+
ui.dialog_trigger(
20+
ui.action_button(
21+
"Trigger Popover",
22+
),
23+
ui.dialog(
24+
ui.heading("Popover"),
25+
ui.content("This is a popover."),
26+
),
27+
type="popover",
28+
default_open=True,
29+
)
30+
)
31+
32+
my_tray = ui.panel(
33+
ui.dialog_trigger(
34+
ui.action_button(
35+
"Trigger Tray",
36+
),
37+
ui.dialog(
38+
ui.heading("Tray"),
39+
ui.content("This is a tray."),
40+
),
41+
type="tray",
42+
default_open=True,
43+
)
44+
)
45+
46+
my_fullscreen = ui.panel(
47+
ui.dialog_trigger(
48+
ui.action_button("Trigger Fullscreen"),
49+
ui.dialog(
50+
ui.heading("Fullscreen"),
51+
ui.content(
52+
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin sit\
53+
amet tristique risus. In sit amet suscipit lorem. Orci varius\
54+
natoque penatibus et magnis dis parturient montes, nascetur\
55+
ridiculus mus. In condimentum imperdiet metus non condimentum. Duis\
56+
eu velit et quam accumsan tempus at id velit. Duis elementum\
57+
elementum purus, id tempus mauris posuere a. Nunc vestibulum sapien\
58+
pellentesque lectus commodo ornare."
59+
),
60+
),
61+
type="fullscreen",
62+
default_open=True,
63+
)
64+
)
65+
66+
67+
my_fullscreen_takeover = ui.panel(
68+
ui.dialog_trigger(
69+
ui.action_button("Trigger Fullscreen"),
70+
ui.dialog(
71+
ui.heading("Fullscreen"),
72+
ui.content(
73+
ui.form(
74+
ui.text_field(label="Name"),
75+
ui.text_field(label="Email address"),
76+
ui.checkbox("Make profile private"),
77+
)
78+
),
79+
),
80+
type="fullscreenTakeover",
81+
default_open=True,
82+
)
83+
)

tests/ui_dialog.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { expect, test } from '@playwright/test';
2+
import { openPanel, gotoPage, SELECTORS } from './utils';
3+
4+
// Tests dialog components render as expected
5+
test.describe('UI dialog components', () => {
6+
['my_popover', 'my_tray'].forEach(name => {
7+
test(name, async ({ page }) => {
8+
await gotoPage(page, '');
9+
await openPanel(page, name, SELECTORS.REACT_PANEL_VISIBLE);
10+
11+
await expect(
12+
page.locator(SELECTORS.REACT_PANEL_VISIBLE)
13+
).toHaveScreenshot();
14+
});
15+
});
16+
17+
['my_modal', 'my_fullscreen', 'my_fullscreen_takeover'].forEach(name => {
18+
test(name, async ({ page }) => {
19+
await gotoPage(page, '');
20+
await openPanel(page, name, SELECTORS.REACT_PANEL_VISIBLE);
21+
22+
await expect(page).toHaveScreenshot();
23+
});
24+
});
25+
});
24.4 KB
Loading
55.1 KB
Loading
24.8 KB
Loading
10.5 KB
Loading
26.9 KB
Loading
10.7 KB
Loading
41.2 KB
Loading

0 commit comments

Comments
 (0)