mirror of
https://github.com/fleetdm/fleet
synced 2026-05-14 20:48:35 +00:00
* Creates new PackComposerPage at /packs/new * Creates PackForm component * Adds PackForm to PackComposerPage * Creates QueriesListItem * Creates QueriesList * Creates QueriesListWrapper * Get all queries when the Packs Composer Page loads * Form HOC handles updates to formData prop * Creates form to configure scheduled queries * QueriesListWrapper renders ConfigurePackQueryForm * search queries input filters queries list * Empty state text * create pack when user submits the new pack form * Adds Edit pack page to /packs/:pack_id/edit * API client - get scheduled queries for a pack * API client - create scheduled query * Redux config for scheduled queries * Remove scheduled queries from packs * Add labels to pack on create * Add disabled state to the select targets dropdown * Adds edit route and pushes to new route on edit click * Adds cancel button to edit pack form * Adds Checkbox that selects all scheduled queries in table
40 lines
1 KiB
JavaScript
40 lines
1 KiB
JavaScript
import React from 'react';
|
|
import expect, { createSpy, restoreSpies } from 'expect';
|
|
import { mount } from 'enzyme';
|
|
|
|
import Checkbox from './Checkbox';
|
|
|
|
describe('Checkbox - component', () => {
|
|
afterEach(restoreSpies);
|
|
|
|
it('renders', () => {
|
|
expect(mount(<Checkbox />)).toExist();
|
|
});
|
|
|
|
it('calls the "onChange" handler when changed', () => {
|
|
const onCheckedComponentChangeSpy = createSpy();
|
|
const onUncheckedComponentChangeSpy = createSpy();
|
|
|
|
const checkedComponent = mount(
|
|
<Checkbox
|
|
name="checkbox"
|
|
onChange={onCheckedComponentChangeSpy}
|
|
value
|
|
/>
|
|
).find('input');
|
|
|
|
const uncheckedComponent = mount(
|
|
<Checkbox
|
|
name="checkbox"
|
|
onChange={onUncheckedComponentChangeSpy}
|
|
value={false}
|
|
/>
|
|
).find('input');
|
|
|
|
checkedComponent.simulate('change');
|
|
uncheckedComponent.simulate('change');
|
|
|
|
expect(onCheckedComponentChangeSpy).toHaveBeenCalledWith(false);
|
|
expect(onUncheckedComponentChangeSpy).toHaveBeenCalledWith(true);
|
|
});
|
|
});
|