mirror of
https://github.com/fleetdm/fleet
synced 2026-05-15 04:58:25 +00:00
* add prettier and have it format all js code except website: : * trying running prettier check in CI * fix runs on in CI * change CI job name * fix prettier erros and fix CI
28 lines
804 B
JavaScript
28 lines
804 B
JavaScript
import React from "react";
|
|
import { mount } from "enzyme";
|
|
import { noop } from "lodash";
|
|
|
|
import { DropdownButton } from "./DropdownButton";
|
|
|
|
describe("DropdownButton - component", () => {
|
|
it("calls the clicked item's onClick attribute", () => {
|
|
const optionSpy = jest.fn();
|
|
const dropdownOptions = [
|
|
{ label: "btn1", onClick: noop },
|
|
{ label: "btn2", onClick: optionSpy },
|
|
];
|
|
const component = mount(
|
|
<DropdownButton options={dropdownOptions}>New Button</DropdownButton>
|
|
);
|
|
|
|
component.find("button.dropdown-button").simulate("click");
|
|
expect(component.state().isOpen).toEqual(true);
|
|
|
|
component
|
|
.find("li.dropdown-button__option")
|
|
.last()
|
|
.find("Button")
|
|
.simulate("click");
|
|
expect(optionSpy).toHaveBeenCalled();
|
|
});
|
|
});
|