FIX: Display 'shown on X' user field flags (#23109)
In this commit 2.5 years ago, variables for showOnUserCard and showOnProfile were removed, but we still used them in the component. e29605b
This corrects the variable names and adds a test to confirm the text is now shown.
This commit is contained in:
parent
a33c878b55
commit
51a976eab9
|
@ -109,6 +109,6 @@
|
|||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">{{this.flags}}</div>
|
||||
<div class="row user-field-flags">{{this.flags}}</div>
|
||||
{{/if}}
|
||||
</div>
|
|
@ -51,10 +51,10 @@ export default Component.extend(bufferedProperty("userField"), {
|
|||
if (userField.required) {
|
||||
ret.push(I18n.t("admin.user_fields.required.enabled"));
|
||||
}
|
||||
if (userField.showOnProfile) {
|
||||
if (userField.show_on_profile) {
|
||||
ret.push(I18n.t("admin.user_fields.show_on_profile.enabled"));
|
||||
}
|
||||
if (userField.showOnUserCard) {
|
||||
if (userField.show_on_user_card) {
|
||||
ret.push(I18n.t("admin.user_fields.show_on_user_card.enabled"));
|
||||
}
|
||||
if (userField.searchable) {
|
||||
|
|
|
@ -37,12 +37,15 @@ module("Integration | Component | admin-user-field-item", function (hooks) {
|
|||
assert.ok(exists(".save"));
|
||||
});
|
||||
|
||||
test("user field with an id", async function (assert) {
|
||||
test("field attributes are rendered correctly", async function (assert) {
|
||||
this.set("userField", {
|
||||
id: 1,
|
||||
field_type: "text",
|
||||
name: "foo",
|
||||
description: "what is foo",
|
||||
show_on_profile: true,
|
||||
show_on_user_card: true,
|
||||
searchable: true,
|
||||
});
|
||||
|
||||
await render(hbs`<AdminUserFieldItem @userField={{this.userField}} />`);
|
||||
|
@ -56,5 +59,13 @@ module("Integration | Component | admin-user-field-item", function (hooks) {
|
|||
query(".field-type").innerText,
|
||||
I18n.t("admin.user_fields.field_types.text")
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(".user-field-flags")
|
||||
.hasText(
|
||||
`${I18n.t("admin.user_fields.show_on_profile.enabled")}, ${I18n.t(
|
||||
"admin.user_fields.show_on_user_card.enabled"
|
||||
)}, ${I18n.t("admin.user_fields.searchable.enabled")}`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue