"README.Rmd" did not exist on "4f7d4192472e0ddb76f18976af5950c78a40c77f"
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);
config.ivPeriodOfRecord = {
'72019': {}
};
config.gwPeriodOfRecord = {
'72019': {}
};
Bucknell, Mary S.
committed
const TEST_STATE = {
hydrographData: {
currentTimeRange: {
start: 1582560000000,
end: 1600700000000
},
primaryIVData: TEST_PRIMARY_IV_DATA
},
groundwaterLevelData: {
all: [TEST_GW_LEVELS]
},
hydrographState: {
showCompareIVData: false,
showMedianData: false,
selectedIVMethodID: '90649',
selectedParameterCode: '72019'
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);