Skip to content

Commit

Permalink
fix(web): map product issues to registration path
Browse files Browse the repository at this point in the history
Restoring code that was deleted by mistake when merging master into
registration feature branch, see

* 4ec593a#diff-421d6e73565e425930eaa42a2799ed6e14d3dccb58da884c7cfc86739b2b0eddR71
* 59c389c#diff-421d6e73565e425930eaa42a2799ed6e14d3dccb58da884c7cfc86739b2b0edd
  • Loading branch information
dgdavid committed Jan 9, 2025
1 parent 95e8542 commit b30e751
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
18 changes: 17 additions & 1 deletion web/src/components/core/IssuesDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,14 @@ describe("IssuesDrawer", () => {
describe("when there are installation issues", () => {
beforeEach(() => {
mockIssuesList = new IssuesList(
[],
[
{
description: "Registration Fake Issue",
source: 0,
severity: 0,
details: "Registration Fake Issue details",
},
],
[
{
description: "Software Fake Issue",
Expand Down Expand Up @@ -97,6 +104,7 @@ describe("IssuesDrawer", () => {
it("renders the drawer with categorized issues linking to their scope", async () => {
const { user } = installerRender(<IssuesDrawer onClose={onCloseFn} />);

const registrationIssues = screen.getByRole("region", { name: "Registration" });
const softwareIssues = screen.getByRole("region", { name: "Software" });
const storageIssues = screen.getByRole("region", { name: "Storage" });
const usersIssues = screen.getByRole("region", { name: "Users" });
Expand All @@ -114,6 +122,14 @@ describe("IssuesDrawer", () => {
expect(usersLink).toHaveAttribute("href", "/users");
within(usersIssues).getByText("Users Fake Issue");

// Regression test: right now, registration issues comes under product
// scope. Check that it links to registration section anyway.
const registrationLink = within(registrationIssues).getByRole("link", {
name: "Registration",
});
expect(registrationLink).toHaveAttribute("href", "/registration");
within(registrationIssues).getByText("Registration Fake Issue");

// onClose should be called when user clicks on a section too for ensuring
// drawer gets closed even when navigation is not needed.
await user.click(usersLink);
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/core/IssuesDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,14 @@ const IssuesDrawer = forwardRef(({ onClose }: { onClose: () => void }, ref) => {
if (issues.length === 0) return null;
// FIXME: address this better or use the /product(s)? namespace instead of
// /registration.
const section = scope === "product" ? "registration" : scope;
const ariaLabelId = `${scope}-issues-section`;

return (
<section key={idx} aria-labelledby={ariaLabelId}>
<Stack hasGutter>
<h4 id={ariaLabelId}>
<Link variant="link" isInline onClick={onClose} to={`/${scope}`}>
<Link variant="link" isInline onClick={onClose} to={`/${section}`}>
{scopeHeaders[scope]}
</Link>
</h4>
Expand Down

0 comments on commit b30e751

Please sign in to comment.