Skip to content

Commit

Permalink
refactor(coral): Update copy (#328)
Browse files Browse the repository at this point in the history
- update copy for browse topics
- update copy in main nav
- update copy in header

Signed-off-by: Mirjam Aulbach <[email protected]>
  • Loading branch information
programmiri authored Dec 15, 2022
1 parent c8c8751 commit 9e41546
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 39 deletions.
20 changes: 11 additions & 9 deletions coral/src/app/features/browse-topics/BrowseTopics.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ const getUrlWithParams = ({
return `/${route}?${new URLSearchParams(params)}`;
};

const filterByEnvironmentLabel = "Filter by environment";
const filterByTeamLabel = "Filter by team";
describe("BrowseTopics.tsx", () => {
beforeAll(() => {
server.listen();
Expand Down Expand Up @@ -182,7 +184,7 @@ describe("BrowseTopics.tsx", () => {
it("renders a select element to filter topics by Kafka environment", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterByEnvironmentLabel,
});

expect(select).toBeEnabled();
Expand All @@ -191,7 +193,7 @@ describe("BrowseTopics.tsx", () => {
it("renders a select element to filter topics by team", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterByTeamLabel,
});

expect(select).toBeEnabled();
Expand Down Expand Up @@ -355,7 +357,7 @@ describe("BrowseTopics.tsx", () => {
it("shows a select element for environments with `ALL` preselected", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterByEnvironmentLabel,
});

expect(select).toHaveValue("ALL");
Expand All @@ -364,7 +366,7 @@ describe("BrowseTopics.tsx", () => {
it("shows an information that the list is updated after user selected an environment", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterByEnvironmentLabel,
});
const option = within(select).getByRole("option", {
name: "DEV",
Expand All @@ -380,7 +382,7 @@ describe("BrowseTopics.tsx", () => {
it("changes active selected option when user selects `DEV`", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterByEnvironmentLabel,
});
const option = within(select).getByRole("option", {
name: "DEV",
Expand All @@ -407,7 +409,7 @@ describe("BrowseTopics.tsx", () => {
expect(getAllTopics()).toHaveLength(10);

const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterByEnvironmentLabel,
});
const option = within(select).getByRole("option", {
name: "DEV",
Expand Down Expand Up @@ -444,7 +446,7 @@ describe("BrowseTopics.tsx", () => {
it("shows a select element for team with `All teams` preselected", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterByTeamLabel,
});

expect(select).toHaveValue("f5ed03b4-c0da-4b18-a534-c7e9a13d1342");
Expand All @@ -453,7 +455,7 @@ describe("BrowseTopics.tsx", () => {
it("changes active selected option when user selects `TEST_TEAM_02`", async () => {
await waitForElementToBeRemoved(screen.getByText("Loading..."));
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterByTeamLabel,
});
const option = within(select).getByRole("option", {
name: "TEST_TEAM_02",
Expand All @@ -480,7 +482,7 @@ describe("BrowseTopics.tsx", () => {
expect(getAllTopics()).toHaveLength(10);

const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterByTeamLabel,
});
const option = within(select).getByRole("option", {
name: "TEST_TEAM_02",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { customRender } from "src/services/test-utils/render-with-wrappers";
import { waitForElementToBeRemoved } from "@testing-library/react/pure";
import userEvent from "@testing-library/user-event";

const filterLabel = "Filter by environment";
describe("SelectEnvironment.tsx", () => {
beforeAll(() => {
server.listen();
Expand Down Expand Up @@ -45,7 +46,7 @@ describe("SelectEnvironment.tsx", () => {

it("shows a select element for Kafka environments", () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterLabel,
});

expect(select).toBeEnabled();
Expand Down Expand Up @@ -142,7 +143,7 @@ describe("SelectEnvironment.tsx", () => {

it("updates state for api call when user selects a new environment", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterLabel,
});
const option = screen.getByRole("option", {
name: mockedEnvironmentDev.name,
Expand All @@ -155,7 +156,7 @@ describe("SelectEnvironment.tsx", () => {

it("sets the environment the user choose as active option", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterLabel,
});
const option = screen.getByRole("option", {
name: mockedEnvironmentDev.name,
Expand Down Expand Up @@ -197,7 +198,7 @@ describe("SelectEnvironment.tsx", () => {

it(`sets "${mockedEnvironmentTst.name}" as search param when user selected it`, async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterLabel,
});

const option = screen.getByRole("option", {
Expand All @@ -215,7 +216,7 @@ describe("SelectEnvironment.tsx", () => {

it("removes search param when user chooses All environment", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: filterLabel,
});

const option = screen.getByRole("option", { name: "All environments" });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function SelectEnv(props: SelectEnvProps) {
} else {
return (
<NativeSelect
labelText="Filter By Environment"
labelText="Filter by environment"
value={environment}
onChange={(event) => onChangeEnv(event.target.value)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { customRender } from "src/services/test-utils/render-with-wrappers";
import { ALL_TEAMS_VALUE } from "src/domain/team/team-types";
import { waitForElementToBeRemoved } from "@testing-library/react/pure";

const filterLabel = "Filter by team";
describe("SelectTeam.tsx", () => {
beforeAll(() => {
server.listen();
Expand Down Expand Up @@ -37,7 +38,7 @@ describe("SelectTeam.tsx", () => {

it("shows a select element for Team", () => {
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterLabel,
});

expect(select).toBeEnabled();
Expand Down Expand Up @@ -134,7 +135,7 @@ describe("SelectTeam.tsx", () => {

it("updates state for api call when user selects a new team", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterLabel,
});
const option = screen.getByRole("option", { name: optionToSelect });

Expand All @@ -145,7 +146,7 @@ describe("SelectTeam.tsx", () => {

it("sets the team the user choose as active option", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterLabel,
});
const option = screen.getByRole("option", { name: optionToSelect });

Expand Down Expand Up @@ -186,7 +187,7 @@ describe("SelectTeam.tsx", () => {

it("sets `TEST_TEAM_01` as search param when user selected it", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: filterLabel,
});

const option = screen.getByRole("option", { name: optionToSelect });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function SelectTeam(props: SelectTeamProps) {
} else {
return (
<NativeSelect
labelText="Filter By Team"
labelText="Filter by team"
value={team}
onChange={(event) => onChangeEnv(event.target.value)}
>
Expand Down
8 changes: 4 additions & 4 deletions coral/src/app/layout/main-navigation/MainNavigation.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ jest.mock("@aivenio/aquarium", () => {

const navLinks = [
{
name: "Overviews",
name: "Dashboard",
linkTo: "/index",
},
{ name: "Audit Log", linkTo: "/activityLog" },
{ name: "Settings", linkTo: "/serverConfig" },
];

const submenuItems = [
{ name: "Kafka Connector", links: ["All Connectors", "Connectors Requests"] },
{ name: "Kafka Connectors", links: ["All Connectors", "Connector Requests"] },
{ name: "Users and Teams", links: ["Users", "Teams", "User Requests"] },
];

Expand All @@ -47,12 +47,12 @@ const submenuItemTopics = [
// is no longer open per default
// keyboard a11y is tested in submenu component
const navOrderFirstLevel = [
{ name: "Overviews", isSubmenu: false },
{ name: "Dashboard", isSubmenu: false },
{ name: "Topics", isSubmenu: true },
{ name: "All Topics", isSubmenu: false },
{ name: "Approval Requests", isSubmenu: false },
{ name: "My Team's Requests", isSubmenu: false },
{ name: "Kafka Connector", isSubmenu: true },
{ name: "Kafka Connectors", isSubmenu: true },
{ name: "Users and Teams", isSubmenu: true },
{ name: "Audit Log", isSubmenu: false },
{ name: "Settings", isSubmenu: false },
Expand Down
8 changes: 4 additions & 4 deletions coral/src/app/layout/main-navigation/MainNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function MainNavigation() {
<MainNavigationLink
icon={database}
href={`/index`}
linkText={"Overviews"}
linkText={"Dashboard"}
/>
</li>
<li>
Expand Down Expand Up @@ -52,15 +52,15 @@ function MainNavigation() {
<li>
<MainNavigationSubmenuList
icon={layoutGroupBy}
text={"Kafka Connector"}
text={"Kafka Connectors"}
>
<MainNavigationLink
href={`/kafkaConnectors`}
linkText={"All Connectors"}
/>
<MainNavigationLink
href={`/kafkaConnectors`}
linkText={"Connectors Requests"}
href={`/execConnectors`}
linkText={"Connector Requests"}
/>
</MainNavigationSubmenuList>
</li>
Expand Down
18 changes: 9 additions & 9 deletions coral/src/app/pages/topics/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,34 +72,34 @@ describe("Topics", () => {

it("shows a headline", async () => {
const headline = screen.getByRole("heading", {
name: "Browse all topics",
name: "All topics",
});

expect(headline).toBeVisible();
});

it("renders 'Request A New Topic' button in heading", async () => {
it("renders 'Request new topic' button in heading", async () => {
const button = screen.getByRole("button", {
name: "Request A New Topic",
name: "Request new topic",
});

expect(button).toBeVisible();
expect(button).toBeEnabled();
});

it("navigates to '/requestTopics' when user clicks the button 'Request A New Topic'", async () => {
it("navigates to '/requestTopics' when user clicks the button 'Request new topic'", async () => {
const button = screen.getByRole("button", {
name: "Request A New Topic",
name: "Request new topic",
});

await userEvent.click(button);

await waitFor(() => expect(window.location.href).toBe("/requestTopics"));
});

it("navigates to '/requestTopics' when user presses Enter while 'Request A New Topic' button is focused", async () => {
it("navigates to '/requestTopics' when user presses Enter while 'Request new topic' button is focused", async () => {
const button = screen.getByRole("button", {
name: "Request A New Topic",
name: "Request new topic",
});

await tabNavigateTo({ targetElement: button });
Expand All @@ -111,15 +111,15 @@ describe("Topics", () => {

it("renders a select element to filter topics by Kafka environment", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Environment",
name: "Filter by environment",
});

expect(select).toBeEnabled();
});

it("renders a select element to filter topics by team", async () => {
const select = screen.getByRole("combobox", {
name: "Filter By Team",
name: "Filter by team",
});

expect(select).toBeEnabled();
Expand Down
4 changes: 2 additions & 2 deletions coral/src/app/pages/topics/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const Topics = () => {
<Layout>
<PreviewBanner linkTarget={"/browseTopics"} />
<PageHeader
title={"Browse all topics"}
title={"All topics"}
primaryAction={{
text: "Request A New Topic",
text: "Request new topic",
// @TODO Replace by useNavigate once the request page is implemented in coral
onClick: () => (window.location.href = "/requestTopics"),
icon: add,
Expand Down

0 comments on commit 9e41546

Please sign in to comment.