Skip to content

Commit 21b4287

Browse files
committed
test new modal component + changelog
1 parent 3834f18 commit 21b4287

File tree

5 files changed

+40
-19
lines changed

5 files changed

+40
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
❯ ./sqlpage create-migration my_new_table
1010
Migration file created: sqlpage/migrations/20250627095944_my_new_table.sql
1111
```
12+
- New [modal](https://sql-page.com/component.sql?component=modal) component
1213

1314
## v0.35.2
1415
- Fix a bug with zero values being displayed with a non-zero height in stacked bar charts.

examples/official-site/sqlpage/migrations/63_modal.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ INSERT INTO example(component, description, properties) VALUES
2626
{"component": "modal","id": "my_modal","title": "A modal box","close": "Close"},
2727
{"contents":"I''m a modal window, and I allow you to display additional information or help for the user."},
2828
{"component": "button"},
29-
{"title":"Open","modal":"my_modal"}
29+
{"title":"Open a simple modal","modal":"my_modal"}
3030
]')
3131
),
3232
('modal',
@@ -40,7 +40,7 @@ INSERT INTO example(component, description, properties) VALUES
4040
"embed":"/examples/form.sql?_sqlpage_embed"
4141
},
4242
{"component": "button"},
43-
{"title":"Open","modal":"my_embed_form_modal"}
43+
{"title":"Open a modal with a form","modal":"my_embed_form_modal"}
4444
]')
4545
),
4646
('modal',
@@ -54,7 +54,7 @@ INSERT INTO example(component, description, properties) VALUES
5454
"embed":"/examples/chart.sql?_sqlpage_embed"
5555
},
5656
{"component": "button"},
57-
{"title":"Open","modal":"my_embed_chart_modal"}
57+
{"title":"Open a modal with a chart","modal":"my_embed_chart_modal"}
5858
]')
5959
),
6060
('modal',
@@ -71,7 +71,7 @@ INSERT INTO example(component, description, properties) VALUES
7171
"height":"350"
7272
},
7373
{"component": "button"},
74-
{"title":"Open","modal":"my_embed_video_modal"}
74+
{"title":"Open a modal with a video","modal":"my_embed_video_modal"}
7575
]')
7676
);
7777

tests/end-to-end/official-site.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,22 @@ test("form component documentation", async ({ page }) => {
194194
page.getByRole("heading", { name: /chart/i, level: 1 }),
195195
).toBeVisible();
196196
});
197+
198+
test("modal", async ({ page }) => {
199+
await page.goto(`${BASE}/documentation.sql?component=modal#component`);
200+
// get the button that opens the modal
201+
const openButton = page.getByRole("button", { name: "Open a simple modal" });
202+
await openButton.click();
203+
204+
const modal = page.getByRole("dialog", { label: "A modal box" });
205+
await expect(modal).toBeVisible();
206+
207+
// close the modal
208+
await page.keyboard.press("Escape");
209+
await expect(modal).not.toBeVisible();
210+
211+
await openButton.click();
212+
await expect(modal).toBeVisible();
213+
await modal.getByRole("button", { label: "Close" }).first().click();
214+
await expect(modal).not.toBeVisible();
215+
});

tests/end-to-end/package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/end-to-end/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "playwright test"
7+
"test": "playwright test --reporter=line",
8+
"gui": "playwright test --ui"
89
},
910
"keywords": [],
1011
"author": "",

0 commit comments

Comments
 (0)