Sha256: 614f926eab010ce20584361eed62844927315598da39f050815ee5236f8a0ee2
Contents?: true
Size: 1.73 KB
Versions: 22
Compression:
Stored size: 1.73 KB
Contents
import React from 'react'; import { testComponentSnapshotsWithFixtures } from 'react-redux-test-utils'; import { shallow } from 'enzyme'; import { getQueryKeyText, getQueryValueText } from '../../TasksDashboardHelper'; import TasksLabelsRow from './TasksLabelsRow'; jest.mock('../../TasksDashboardHelper'); getQueryKeyText.mockImplementation(val => val); getQueryValueText.mockImplementation(val => val); const fixtures = { 'render with minimal props': {}, 'render with props': { query: { some: 'query' }, updateQuery: jest.fn(), }, }; describe('TasksLabelsRow', () => { describe('rendering', () => testComponentSnapshotsWithFixtures(TasksLabelsRow, fixtures)); describe('triggering', () => { it('should trigger updateQuery when label delete-click', () => { const updateQuery = jest.fn(); const query = { some: 'query', someOther: 'some-query' }; const component = shallow( <TasksLabelsRow query={query} updateQuery={updateQuery} /> ); const labels = component.find('Label'); const firstLabel = labels.first(); const secondLabel = labels.at(1); firstLabel.simulate('removeClick'); expect(updateQuery).toHaveBeenCalledWith({ someOther: 'some-query' }); secondLabel.simulate('removeClick'); expect(updateQuery).toHaveBeenCalledWith({ some: 'query' }); }); it('should trigger updateQuery when -clear-all- click', () => { const updateQuery = jest.fn(); const query = { some: 'query', someOther: 'some-query' }; const component = shallow( <TasksLabelsRow query={query} updateQuery={updateQuery} /> ); component.find('Button').simulate('click'); expect(updateQuery).toHaveBeenCalledWith({}); }); }); });
Version data entries
22 entries across 22 versions & 1 rubygems