FIX: Don't add the no-text class if translatedLabel is present (#22111)

This commit is contained in:
Roman Rizzi 2023-06-14 12:18:17 -03:00 committed by GitHub
parent 9e20fcb9c1
commit 1865eb1de3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -10,7 +10,7 @@ export const ButtonClass = {
buildClasses(attrs) {
let className = this.attrs.className || "";
let hasText = attrs.label || attrs.contents;
let hasText = attrs.translatedLabel || attrs.label || attrs.contents;
if (!hasText) {
className += " no-text";

View File

@ -63,4 +63,12 @@ module("Integration | Component | Widget | button", function (hooks) {
assert.strictEqual(query("button").title, "foo bar");
});
test("translatedLabel skips no-text class in icon", async function (assert) {
this.set("args", { icon: "plus", translatedLabel: "foo bar" });
await render(hbs`<MountWidget @widget="button" @args={{this.args}} />`);
assert.ok(!exists("button.btn.btn-icon.no-text"), "skips no-text class");
});
});