DEV: Update default modal alert class (#22416)

This PR changes the default to not append any classes (when `@flashType` isn't present) and instead leans on the `alert` class for styling the alert which is a 1 to 1 match of the `alert-error` class.

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L1-L4)

8f21d2cf40/app/assets/stylesheets/common/base/alert.scss (L22-L24)

In essence this changes the default modal alert styling from `success` to `error` if not overridden by `@flashType`
This commit is contained in:
Isaac Janzen 2023-07-04 15:22:14 -05:00 committed by GitHub
parent 904450594d
commit aaccb774de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -70,7 +70,7 @@
role="alert" role="alert"
class={{concat-class class={{concat-class
"alert" "alert"
(concat "alert-" (or @flashType "success")) (if @flashType (concat "alert-" @flashType))
}} }}
> >
{{~@flash~}} {{~@flash~}}

View File

@ -39,10 +39,15 @@ module("Integration | Component | d-modal", function (hooks) {
}); });
test("flash", async function (assert) { test("flash", async function (assert) {
await render(hbs`<DModal @inline={{true}} @flash="Some message"/>`);
assert.dom(".d-modal .alert").hasText("Some message");
});
test("flash type", async function (assert) {
await render( await render(
hbs`<DModal @inline={{true}} @flash="Some message" @flashType="error"/> ` hbs`<DModal @inline={{true}} @flash="Some message" @flashType="success"/>`
); );
assert.dom(".d-modal .alert.alert-error").hasText("Some message"); assert.dom(".d-modal .alert").hasClass("alert-success");
}); });
test("dismissable", async function (assert) { test("dismissable", async function (assert) {