Skip to content

A platform for community discussion. Free, open, simple.

DEV: Add tests for sidebar accessibility changes (#19138)

Alan Guo Xiang Tane05cd5de8ffc
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
index 24e7473b181..a8d5f44b012 100644
--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js
@@ -195,5 +195,25 @@ acceptance(
"the 3 topic tracking state change callbacks are removed"
);
});
+
+ test("accessibility of sidebar section header", async function (assert) {
+ await visit("/");
+
+ assert.ok(
+ exists(
+ ".sidebar-section-community .sidebar-section-header[aria-expanded='true'][aria-controls='sidebar-section-content-community']"
+ ),
+ "accessibility attributes are set correctly on sidebar section header when section is expanded"
+ );
+
+ await click(".sidebar-section-header");
+
+ assert.ok(
+ exists(
+ ".sidebar-section-community .sidebar-section-header[aria-expanded='false'][aria-controls='sidebar-section-content-community']"
+ ),
+ "accessibility attributes are set correctly on sidebar section header when section is collapsed"
+ );
+ });
}
);