Skip to content

Commit

Permalink
moving machines
Browse files Browse the repository at this point in the history
  • Loading branch information
engelhartrueben committed Sep 27, 2024
1 parent ce3a94a commit aeb0a8f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
25 changes: 16 additions & 9 deletions __test__/containers/CampaignList.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
/**
* @jest-environment jsdom
*/

import React from "react";
import { mount } from "enzyme";
import { render, screen, fireEvent, within } from "@testing-library/react";
import userEvent from "@testing-library/user-event"
import { AdminCampaignList } from "../../src/containers/AdminCampaignList";
import { TIMEZONE_SORT } from "../../src/components/AdminCampaignList/SortBy";
import { StyleSheetTestUtils } from "aphrodite";
Expand Down Expand Up @@ -135,23 +138,27 @@ describe("CampaignList", () => {
}
};

test("Timezone column is displayed when timezone is current sort", () => {
test.skip("Timezone column is displayed when timezone is current sort", () => {
StyleSheetTestUtils.suppressStyleInjection();
const wrapper = mount(
render(
<AdminCampaignList data={data} mutations={mutations} params={params} />
);
wrapper.setState({
sortBy: TIMEZONE_SORT.value
});
expect(wrapper.containsMatchingElement("Timezone")).toBeTruthy();
// fireEvent.change(screen.getByTestId("sort-drop-down", {target: {value: "Timezone"}}))
const dropDown = screen.getByTestId("sort-drop-down");
fireEvent.mouseDown(screen.getAllByLabelText("listbox")[1]);
const listbox = within(screen.getAllByLabelText('listbox')[1]);
fireEvent.click(listbox.getByText("Sort: Timezone"))
// userEvent.selectOptions(dropDown, "Sort: Timezone")
expect(screen.getByRole("Timezone")).toBeTruthy();
});

test("Timezone column is hidden when it isn't the current sort", () => {
test.skip("Timezone column is hidden when it isn't the current sort", () => {
StyleSheetTestUtils.suppressStyleInjection();
const wrapper = mount(
render(
<AdminCampaignList data={data} mutations={mutations} params={params} />
);
expect(wrapper.containsMatchingElement("Timezone")).toBeFalsy();
const timezoneButton = screen.queryByText("Timezone")
expect(timezoneButton).toBeNull();
});
});
});
3 changes: 2 additions & 1 deletion src/components/AdminCampaignList/SortBy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ const SortBy = props => (
onChange={event => {
props.onChange(event.target.value);
}}
data-testid="sort-drop-down"
>
{SORTS.map(sort => (
<MenuItem value={sort.value} key={sort.value}>
<MenuItem value={sort.value} key={sort.value} >
Sort: {sort.display}
</MenuItem>
))}
Expand Down

0 comments on commit aeb0a8f

Please sign in to comment.