Skip to content
Snippets Groups Projects
Commit 591c1b07 authored by Fry, Janell's avatar Fry, Janell
Browse files

IOW-307 Fixing some peer review comments from Mary.

parent 3493f2fd
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,7 @@ describe('DV: Legend module', () => {
currentTimeSeriesId: '12345',
showSeries: {
current: true
}
}
},
ui: {
windowWidth: 1024,
......
......@@ -2,7 +2,7 @@
// selector function which will return the width/height to use.
import memoize from 'fast-memoize';
import { createSelector } from 'reselect';
import {createSelector} from 'reselect';
import config from '../../config';
import {getCurrentParmCd} from '../../selectors/time-series-selector';
......@@ -26,7 +26,7 @@ const MARGIN_SMALL_DEVICE = {
bottom: 10,
left: 0
};
//export const CIRCLE_RADIUS = 4;
export const CIRCLE_RADIUS_SINGLE_PT = 1;
export const BRUSH_HEIGHT = 100;
......
import {select, selectAll} from 'd3-selection';
import {legendMarkerRowsSelector, drawTimeSeriesLegend} from './legend';
import {drawSimpleLegend} from '../../d3-rendering/legend';
import {lineMarker, rectangleMarker, textOnlyMarker} from '../../d3-rendering/markers';
import {Actions, configureStore} from '../../store';
......@@ -94,82 +93,6 @@ describe('UV: Legend module', () => {
}
};
describe('drawSimpleLegend', () => {
let container;
const legendMarkerRows = [
[{
type: lineMarker,
length: 20,
domId: 'some-id',
domClass: 'some-class',
text: 'Some Text'
}, {
type: rectangleMarker,
domId: 'some-rectangle-id',
domClass: 'some-rectangle-class',
text: 'Rectangle Marker'
}],
[{
type: textOnlyMarker,
domId: 'text-id',
domClass: 'text-class',
text: 'Label'
}, {
type: lineMarker,
domId: null,
domClass: 'some-other-class',
text: 'Median Label'
}]
];
const layout = {
width: 100,
height: 100,
margin: {
top: 0,
right: 0,
bottom: 0,
left: 0
}
};
beforeEach(() => {
container = select('body').append('div');
});
afterEach(() => {
container.remove();
});
it('Does not add a legend svg if no markers are provided', () => {
drawSimpleLegend(container, {
legendMarkerRows: [],
layout: layout
});
expect(container.select('svg').size()).toBe(0);
});
it('Does not add a legend if the layout is null', () => {
drawSimpleLegend(container, {
legendMarkerRows: legendMarkerRows,
layout: undefined
});
expect(container.select('svg').size()).toBe(0);
});
it('Adds a legend when width is provided', () => {
drawSimpleLegend(container, {legendMarkerRows, layout});
expect(container.select('svg').size()).toBe(1);
expect(container.selectAll('line').size()).toBe(2);
expect(container.selectAll('rect').size()).toBe(1);
expect(container.selectAll('text').size()).toBe(4);
});
});
describe('legendMarkerRowSelector', () => {
it('Should return no markers if no time series to show', () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment