-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cherrypick: fix for icons showing/not showing in activities (#26906)
- Loading branch information
1 parent
8467903
commit fdd68bc
Showing
9 changed files
with
147 additions
and
9 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
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
41 changes: 41 additions & 0 deletions
41
...etails/cards/Activity/ActivityItems/LockedHostActivityItem/LockHostActivityItem.tests.tsx
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,41 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { createMockHostPastActivity } from "__mocks__/activityMock"; | ||
|
||
import LockHostActivityItem from "./LockedHostActivityItem"; | ||
|
||
describe("LockHostActivityItem", () => { | ||
it("renders the activity content", () => { | ||
render( | ||
<LockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.getByText("Test User")).toBeVisible(); | ||
expect(screen.getByText(/locked this host/i)).toBeVisible(); | ||
}); | ||
|
||
it("does not render the cancel icon", () => { | ||
render( | ||
<LockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.queryByTestId("close-icon")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("does not render the show details icon", () => { | ||
render( | ||
<LockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.queryByTestId("info-outline-icon")).not.toBeInTheDocument(); | ||
}); | ||
}); |
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
58 changes: 58 additions & 0 deletions
58
...ls/cards/Activity/ActivityItems/UnlockedHostActivityItem/UnlockHostActivityItem.tests.tsx
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,58 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { createMockHostPastActivity } from "__mocks__/activityMock"; | ||
|
||
import UnlockHostActivityItem from "./UnlockedHostActivityItem"; | ||
|
||
describe("UnlockHostActivityItem", () => { | ||
it("renders the activity content for darwin hosts", () => { | ||
render( | ||
<UnlockHostActivityItem | ||
activity={createMockHostPastActivity({ | ||
actor_full_name: "Test User", | ||
details: { host_platform: "darwin" }, | ||
})} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.getByText("Test User")).toBeVisible(); | ||
expect( | ||
screen.getByText("viewed the six-digit unlock PIN for this host.") | ||
).toBeVisible(); | ||
}); | ||
|
||
it("renders the activity content for non-darwin hosts", () => { | ||
render( | ||
<UnlockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.getByText("Test User")).toBeVisible(); | ||
expect(screen.getByText(/unlocked this host/i)).toBeVisible(); | ||
}); | ||
|
||
it("does not render the cancel icon", () => { | ||
render( | ||
<UnlockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.queryByTestId("close-icon")).not.toBeInTheDocument(); | ||
}); | ||
|
||
it("does not render the show details icon", () => { | ||
render( | ||
<UnlockHostActivityItem | ||
activity={createMockHostPastActivity({ actor_full_name: "Test User" })} | ||
tab="past" | ||
/> | ||
); | ||
|
||
expect(screen.queryByTestId("info-outline-icon")).not.toBeInTheDocument(); | ||
}); | ||
}); |
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