FIX: expanding / collapsing own user info panel (#30272)
When viewing your own user profile, we offer the ability to expand / collapse your user info. By default, the info are collapsed and the button to toggle it only worked once. Meaning you could expand the info but not collapse it back. This fixes the issue by using `toggleProperty()` instead of directly `set()`-ing a value. Also added an acceptance test to ensure it doesn't regress. Was reported in https://meta.discourse.org/t/342254
This commit is contained in:
parent
bdd4392c01
commit
29dad8bbea
|
@ -84,7 +84,7 @@ export default class UserController extends Controller.extend(CanCheckEmails) {
|
|||
ariaLabel: this.collapsedInfo
|
||||
? "user.sr_expand_profile"
|
||||
: "user.sr_collapse_profile",
|
||||
action: this.collapsedInfo ? "expandProfile" : "collapseProfile",
|
||||
action: "toggleProfile",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -208,13 +208,8 @@ export default class UserController extends Controller.extend(CanCheckEmails) {
|
|||
}
|
||||
|
||||
@action
|
||||
collapseProfile() {
|
||||
this.set("forceExpand", false);
|
||||
}
|
||||
|
||||
@action
|
||||
expandProfile() {
|
||||
this.set("forceExpand", true);
|
||||
toggleProfile() {
|
||||
this.toggleProperty("forceExpand");
|
||||
}
|
||||
|
||||
@action
|
||||
|
|
|
@ -25,6 +25,21 @@ acceptance("User Profile - Summary", function (needs) {
|
|||
.exists("top categories");
|
||||
});
|
||||
|
||||
test("Viewing Summary - Expanding / collapsing info", async function (assert) {
|
||||
await visit("/u/eviltrout/summary");
|
||||
|
||||
const collapsed = `button[aria-controls="collapsed-info-panel"][aria-expanded="false"]`;
|
||||
const expanded = `button[aria-controls="collapsed-info-panel"][aria-expanded="true"]`;
|
||||
|
||||
assert.dom(collapsed).exists("info panel is collapsed");
|
||||
|
||||
await click(collapsed);
|
||||
assert.dom(expanded).exists("info panel is expanded");
|
||||
|
||||
await click(expanded);
|
||||
assert.dom(collapsed).exists("info panel is collapsed");
|
||||
});
|
||||
|
||||
test("Top Categories Search", async function (assert) {
|
||||
await visit("/u/eviltrout/summary");
|
||||
|
||||
|
|
Loading…
Reference in New Issue