-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI - Update targeted platforms display logic in the queries table (#2…
…5037) ### Unreleased bug where queries targeting all platforms display as targeting no platforms in the Queries table. The below query is set to target _all_ platforms. **Bug:** <img width="1248" alt="Screenshot 2024-12-29 at 8 24 50 PM" src="https://github.com/user-attachments/assets/90c9a498-f7d8-4d86-88f1-061c985fb4fa" /> **Fix:** Targeting all platforms, frequency set, displays platform icons: <img width="1248" alt="Screenshot 2024-12-29 at 8 25 25 PM" src="https://github.com/user-attachments/assets/d03c1bba-e5ea-461a-b506-1840cf4ffa8e" /> Targeting all paltforms but no frequency set (i.e., no schedule), no targeted platforms displayed: <img width="1248" alt="Screenshot 2024-12-29 at 8 25 38 PM" src="https://github.com/user-attachments/assets/9b08a8c3-b682-4eb0-aeb4-59a6e0144e14" /> - [x] Manual QA for all new/changed functionality - [x] Updated tests --------- Co-authored-by: Jacob Shandling <[email protected]>
- Loading branch information
1 parent
ca37183
commit fea4dd7
Showing
4 changed files
with
60 additions
and
41 deletions.
There are no files selected for viewing
26 changes: 16 additions & 10 deletions
26
frontend/components/TableContainer/DataTable/PlatformCell/PlatformCell.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 |
---|---|---|
@@ -1,34 +1,40 @@ | ||
import React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
import { DEFAULT_EMPTY_CELL_VALUE } from "utilities/constants"; | ||
|
||
import { QueryablePlatform } from "interfaces/platform"; | ||
import { ScheduledQueryablePlatform } from "interfaces/platform"; | ||
import PlatformCell from "./PlatformCell"; | ||
|
||
const PLATFORMS: QueryablePlatform[] = ["windows", "darwin", "linux", "chrome"]; | ||
const SCHEDULED_QUERYABLE_PLATFORMS: ScheduledQueryablePlatform[] = [ | ||
"windows", | ||
"darwin", | ||
"linux", | ||
]; | ||
|
||
describe("Platform cell", () => { | ||
it("renders platform icons in correct order", () => { | ||
render(<PlatformCell platforms={PLATFORMS} />); | ||
render(<PlatformCell platforms={SCHEDULED_QUERYABLE_PLATFORMS} />); | ||
|
||
const icons = screen.queryByTestId("icons"); | ||
const appleIcon = screen.queryByTestId("darwin-icon"); | ||
const linuxIcon = screen.queryByTestId("linux-icon"); | ||
const windowsIcon = screen.queryByTestId("windows-icon"); | ||
const chromeIcon = screen.queryByTestId("chrome-icon"); | ||
|
||
expect(icons?.firstChild).toBe(appleIcon); | ||
expect(icons?.firstChild?.nextSibling).toBe(windowsIcon); | ||
expect(icons?.firstChild?.nextSibling?.nextSibling).toBe(linuxIcon); | ||
expect(icons?.firstChild?.nextSibling?.nextSibling?.nextSibling).toBe( | ||
chromeIcon | ||
); | ||
}); | ||
it("renders empty state", () => { | ||
it("renders all platforms targeted when no platforms passed in and scheduled", () => { | ||
render(<PlatformCell platforms={[]} />); | ||
|
||
const emptyText = screen.queryByText(DEFAULT_EMPTY_CELL_VALUE); | ||
const icons = screen.queryByTestId("icons"); | ||
const appleIcon = screen.queryByTestId("darwin-icon"); | ||
const linuxIcon = screen.queryByTestId("linux-icon"); | ||
const windowsIcon = screen.queryByTestId("windows-icon"); | ||
|
||
expect(emptyText).toBeInTheDocument(); | ||
expect(icons?.firstChild).toBe(appleIcon); | ||
expect(icons?.firstChild?.nextSibling).toBe(windowsIcon); | ||
expect(icons?.firstChild?.nextSibling?.nextSibling).toBe(linuxIcon); | ||
}); | ||
}); |
47 changes: 19 additions & 28 deletions
47
frontend/components/TableContainer/DataTable/PlatformCell/PlatformCell.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
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