Newer
Older
import {select, selectAll} from 'd3-selection';
Bucknell, Mary S.
committed
import * as utils from 'ui/utils';
Bucknell, Mary S.
committed
Bucknell, Mary S.
committed
import {drawTimeSeriesLegend} from './legend';
import {TEST_PRIMARY_IV_DATA, TEST_GW_LEVELS} from './mock-hydrograph-state';
Bucknell, Mary S.
committed
describe('monitoring-location/components/hydrograph/legend module', () => {
Bucknell, Mary S.
committed
utils.mediaQuery = jest.fn().mockReturnValue(true);
Bucknell, Mary S.
committed
const TEST_STATE = {
hydrographData: {
primaryIVData: TEST_PRIMARY_IV_DATA,
groundwaterLevels: TEST_GW_LEVELS
},
hydrographState: {
selectedIVMethodID: '90649'
describe('legends should render', () => {
let graphNode;
Bucknell, Mary S.
committed
let store;
beforeEach(() => {
let body = select('body');
let component = body.append('div')
.attr('id', 'hydrograph');
component.append('div').attr('class', 'loading-indicator-container');
component.append('div').attr('class', 'graph-container');
component.append('div').attr('class', 'select-time-series-container');
graphNode = document.getElementById('hydrograph');
store = configureStore(TEST_STATE);
Bucknell, Mary S.
committed
select(graphNode)
Bucknell, Mary S.
committed
.call(drawTimeSeriesLegend, store);
Bucknell, Mary S.
committed
});
afterEach(() => {
select('#hydrograph').remove();
});
it('Should have the correct number of legend markers', () => {
Bucknell, Mary S.
committed
expect(selectAll('.legend g').size()).toBe(9);