Skip to content

Commit 304a377

Browse files
mkerz-masfglovasoa
andauthored
Restore the default info color of alerts (#1698)
* Update CHANGELOG.md * Restore the default info color of alerts The default value " info" had a leading space, so an alert without color got the classes "alert-" and "info" instead of "alert-info" and was grey. The role attribute had the same leading space. * Add alert default color fixture page * Test the default color and the role of alerts --------- Co-authored-by: Ophir LOJKINE <contact@ophir.dev>
1 parent 035fa61 commit 304a377

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## unreleased
44

5+
- An `alert` without `color` uses the info color again, and its `role` attribute no longer starts with a space. ([#1697](https://github.com/sqlpage/SQLPage/issues/1697))
56
- New `create_new_text` and `no_results_text` properties on `select` fields translate the dropdown texts "Add …" and "No results found". The row that creates a new value is now announced by screen readers when it is the active option. ([#1699](https://github.com/sqlpage/SQLPage/issues/1699))
67
- The `table` component can fetch and display HTML fragments in selected columns using `embed`.
78
- New `navbar_toggle_label` property on the `shell` and `close_label` property on the `alert` component, to translate the accessible names of the menu toggle button and of the alert close button. ([#1632](https://github.com/sqlpage/SQLPage/issues/1632))

‎sqlpage/templates/alert.handlebars‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<div {{~#if id}} id="{{id}}" {{/if}} class="alert alert-{{default color " info"}} {{class}} {{~#if dismissible}}
2-
alert-dismissible{{/if~}} {{~#if important}} alert-important{{/if~}} " role=" alert">
1+
<div {{~#if id}} id="{{id}}" {{/if}} class="alert alert-{{default color "info"}} {{class}} {{~#if dismissible}}
2+
alert-dismissible{{/if~}} {{~#if important}} alert-important{{/if~}} " role="alert">
33

44
{{~#if icon~}}
55
<div class="icon alert-icon">
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT 'alert' AS component, 'Default color' AS title, 'No color property.' AS description;
2+
SELECT 'alert' AS component, 'Explicit color' AS title, 'red' AS color;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { expect, test } from "../../fixture.ts";
2+
3+
test("an alert without color uses the info color", async ({ page }) => {
4+
await expect(page.locator(".alert").first()).toHaveClass(/\balert-info\b/);
5+
});
6+
7+
test("the role attribute of every alert is exactly alert", async ({ page }) => {
8+
await expect(page.locator('.alert[role="alert"]')).toHaveCount(2);
9+
});

0 commit comments

Comments
 (0)