Skip to content

Commit 6651a1b

Browse files
committed
Fix a bug where the table component would not add the right css classes to table cells
fixes #762
1 parent 8825e3a commit 6651a1b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.33.0 (unreleased)
44

55
- Add support for HTTP Basic Authentication in the [fetch](https://sql-page.com/documentation.sql?component=fetch#component) function.
6+
- Fix a bug where the table component would not add the right css classes to table cells.
67

78
## 0.32.1 (2025-01-03)
89

sqlpage/templates/table.handlebars

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,10 @@
5050
<tr class="{{_sqlpage_css_class}} {{#if _sqlpage_color}}bg-{{_sqlpage_color}}-lt{{/if}}" {{#if _sqlpage_id}}id="{{_sqlpage_id}}"{{/if}}>
5151
{{~#each this~}}
5252
{{~#if (not (starts_with @key '_sqlpage_'))~}}
53-
<td class="
54-
{{~@key~}}
53+
<td class="align-middle {{@key~}}
5554
{{~#if (array_contains_case_insensitive ../../align_right @key)}} text-end {{/if~}}
5655
{{~#if (array_contains_case_insensitive ../../align_center @key)}} text-center {{/if~}}
57-
align-middle">
56+
">
5857
{{~#if (array_contains_case_insensitive ../../markdown @key)~}}
5958
{{{markdown this}}}
6059
{{~else~}}

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ test("table filtering", async ({ page }) => {
9090

9191
const searchInput = tableSection.getByPlaceholder("Search…");
9292
await searchInput.fill("chart");
93-
await expect(tableSection.getByRole("cell", { name: "Chart" })).toBeVisible();
93+
const chartCell = tableSection.getByRole("cell", { name: "Chart" });
94+
await expect(chartCell).toBeVisible();
95+
await expect(chartCell).toHaveClass(/\bname\b/);
96+
await expect(chartCell).toHaveCSS('vertical-align', 'middle');
9497
await expect(
9598
tableSection.getByRole("cell", { name: "Table" }),
9699
).not.toBeVisible();

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

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

0 commit comments

Comments
 (0)