diff --git a/app/assets/javascripts/discourse/app/controllers/user.js b/app/assets/javascripts/discourse/app/controllers/user.js index eed95755ed9..224c1d3d4c8 100644 --- a/app/assets/javascripts/discourse/app/controllers/user.js +++ b/app/assets/javascripts/discourse/app/controllers/user.js @@ -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 diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js index e924d9418f1..3f659a55352 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-profile-summary-test.js @@ -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");