-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into invite-users-via-email
- Loading branch information
Showing
96 changed files
with
952 additions
and
1,626 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import * as React from "react"; | ||
|
||
import { UnconnectedMainSideNav } from "~/features/common/nav/v2/MainSideNav"; | ||
import { | ||
configureNavGroups, | ||
findActiveNav, | ||
NavConfigGroup, | ||
} from "~/features/common/nav/v2/nav-config"; | ||
|
||
const ACTIVE_BACKGROUND_COLOR = "rgb(119, 69, 240)"; | ||
const INACTIVE_BACKGROUND_COLOR = "rgba(0, 0, 0, 0)"; | ||
|
||
const selectLinkColor = (title: string) => | ||
cy.contains("a", title).should("have.css", "background-color"); | ||
|
||
const verifyActiveState = ({ | ||
active, | ||
inactive, | ||
}: { | ||
active: string[]; | ||
inactive: string[]; | ||
}) => { | ||
active.forEach((title) => { | ||
selectLinkColor(title).should("eql", ACTIVE_BACKGROUND_COLOR); | ||
}); | ||
inactive.forEach((title) => { | ||
selectLinkColor(title).should("eql", INACTIVE_BACKGROUND_COLOR); | ||
}); | ||
}; | ||
|
||
describe("UnconnectedMainSideNav", () => { | ||
it("renders children nav links", () => { | ||
const config: NavConfigGroup[] = [ | ||
{ | ||
title: "Consent", | ||
routes: [ | ||
{ | ||
title: "Privacy notices", | ||
path: "/consent/privacy-notices", | ||
scopes: [], | ||
}, | ||
{ | ||
title: "Privacy experiences", | ||
path: "/consent/privacy-experiences", | ||
scopes: [], | ||
}, | ||
], | ||
}, | ||
{ | ||
title: "Management", | ||
routes: [ | ||
{ | ||
title: "Users", | ||
path: "/users", | ||
scopes: [], | ||
}, | ||
], | ||
}, | ||
]; | ||
const navGroups = configureNavGroups({ | ||
config, | ||
userScopes: [], | ||
}); | ||
const path = "/consent/privacy-notices"; | ||
const activeNav = findActiveNav({ navGroups, path }); | ||
|
||
// First check if the active path is /consent/privacy-notices | ||
cy.mount(<UnconnectedMainSideNav groups={navGroups} active={activeNav} />); | ||
|
||
// Renders groups as buttons (for accordion) | ||
cy.contains("nav button", "Consent"); | ||
|
||
// Renders links as links | ||
cy.contains("nav a", "Privacy notices"); | ||
cy.contains("nav a", "Privacy experiences"); | ||
cy.contains("nav a", "Users"); | ||
|
||
verifyActiveState({ | ||
active: ["Privacy notices"], | ||
inactive: ["Privacy experiences", "Users"], | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.