From 29f2ac6fd85ec228555514868d733518e3890725 Mon Sep 17 00:00:00 2001 From: mbucknell <mbucknell@usgs.gov> Date: Tue, 17 Nov 2020 15:32:35 -0600 Subject: [PATCH] Replace d3render with relative imports within the d3-rendering directory --- assets/src/scripts/d3-rendering/accessibility.spec.js | 4 +++- assets/src/scripts/d3-rendering/alerts.spec.js | 2 +- assets/src/scripts/d3-rendering/axes.spec.js | 2 +- assets/src/scripts/d3-rendering/cursor-slider.spec.js | 2 +- assets/src/scripts/d3-rendering/data-masks.spec.js | 2 +- assets/src/scripts/d3-rendering/graph-tooltip.spec.js | 2 +- assets/src/scripts/d3-rendering/legend.js | 2 +- assets/src/scripts/d3-rendering/legend.spec.js | 5 +++-- assets/src/scripts/d3-rendering/loading-indicator.spec.js | 3 ++- assets/src/scripts/d3-rendering/markers.spec.js | 3 ++- assets/src/scripts/d3-rendering/tick-marks.spec.js | 2 +- assets/src/scripts/{ => d3-rendering}/tooltips.js | 2 +- assets/src/scripts/{ => d3-rendering}/tooltips.spec.js | 5 +++-- assets/src/scripts/index.spec.js | 2 +- .../monitoring-location/components/hydrograph/parameters.js | 3 ++- .../monitoring-location/components/map/flood-slider.js | 3 ++- 16 files changed, 26 insertions(+), 18 deletions(-) rename assets/src/scripts/{ => d3-rendering}/tooltips.js (91%) rename assets/src/scripts/{ => d3-rendering}/tooltips.spec.js (91%) diff --git a/assets/src/scripts/d3-rendering/accessibility.spec.js b/assets/src/scripts/d3-rendering/accessibility.spec.js index e9465cf9c..c97d7a2ae 100644 --- a/assets/src/scripts/d3-rendering/accessibility.spec.js +++ b/assets/src/scripts/d3-rendering/accessibility.spec.js @@ -1,6 +1,8 @@ -import {addSVGAccessibility, addSROnlyTable} from 'd3render/accessibility'; import {select} from 'd3-selection'; +import {addSVGAccessibility, addSROnlyTable} from './accessibility'; + + describe('svgAccessibility tests', () => { describe('addAccessibility tests', () => { diff --git a/assets/src/scripts/d3-rendering/alerts.spec.js b/assets/src/scripts/d3-rendering/alerts.spec.js index 60c3b5421..d2b0aca42 100644 --- a/assets/src/scripts/d3-rendering/alerts.spec.js +++ b/assets/src/scripts/d3-rendering/alerts.spec.js @@ -1,6 +1,6 @@ import {select} from 'd3-selection'; -import {drawInfoAlert, drawErrorAlert, drawSuccessAlert, drawWarningAlert} from 'd3render/alerts'; +import {drawInfoAlert, drawErrorAlert, drawSuccessAlert, drawWarningAlert} from './alerts'; describe('alerts module', () => { let container; diff --git a/assets/src/scripts/d3-rendering/axes.spec.js b/assets/src/scripts/d3-rendering/axes.spec.js index 400e4cdba..eeda4ba82 100644 --- a/assets/src/scripts/d3-rendering/axes.spec.js +++ b/assets/src/scripts/d3-rendering/axes.spec.js @@ -1,6 +1,6 @@ import {select} from 'd3-selection'; -import {appendXAxis, appendYAxis, appendSecondaryYAxis, appendAxes} from 'd3render/axes'; +import {appendXAxis, appendYAxis, appendSecondaryYAxis, appendAxes} from './axes'; describe('axes module', () => { let svg, layout; diff --git a/assets/src/scripts/d3-rendering/cursor-slider.spec.js b/assets/src/scripts/d3-rendering/cursor-slider.spec.js index 3edcced23..fc5f3533b 100644 --- a/assets/src/scripts/d3-rendering/cursor-slider.spec.js +++ b/assets/src/scripts/d3-rendering/cursor-slider.spec.js @@ -1,7 +1,7 @@ import {scaleLinear} from 'd3-scale'; import {select} from 'd3-selection'; -import {drawCursorSlider} from 'd3render/cursor-slider'; +import {drawCursorSlider} from './cursor-slider'; describe('cursor-slider', () => { describe('drawCursorSlider', () => { diff --git a/assets/src/scripts/d3-rendering/data-masks.spec.js b/assets/src/scripts/d3-rendering/data-masks.spec.js index 5d1219716..98d83552c 100644 --- a/assets/src/scripts/d3-rendering/data-masks.spec.js +++ b/assets/src/scripts/d3-rendering/data-masks.spec.js @@ -1,6 +1,6 @@ import {select} from 'd3-selection'; -import {renderMaskDefs} from 'd3render/data-masks'; +import {renderMaskDefs} from './data-masks'; describe('d3-rendering/data-masks', () => { describe('renderMaskDefs', () => { diff --git a/assets/src/scripts/d3-rendering/graph-tooltip.spec.js b/assets/src/scripts/d3-rendering/graph-tooltip.spec.js index 679328ec6..afe4ad7a1 100644 --- a/assets/src/scripts/d3-rendering/graph-tooltip.spec.js +++ b/assets/src/scripts/d3-rendering/graph-tooltip.spec.js @@ -1,7 +1,7 @@ import {scaleLinear} from 'd3-scale'; import {select} from 'd3-selection'; -import {drawFocusOverlay, drawFocusLine, drawFocusCircles} from 'd3render/graph-tooltip'; +import {drawFocusOverlay, drawFocusLine, drawFocusCircles} from './graph-tooltip'; describe('graph-tooltip module', () => { let svg; diff --git a/assets/src/scripts/d3-rendering/legend.js b/assets/src/scripts/d3-rendering/legend.js index ef634e614..1aa771e9c 100644 --- a/assets/src/scripts/d3-rendering/legend.js +++ b/assets/src/scripts/d3-rendering/legend.js @@ -1,5 +1,5 @@ -import {mediaQuery} from 'ui/utils'; import config from 'ui/config'; +import {mediaQuery} from 'ui/utils'; const RECTANGLE_MARKER_WIDTH = 20; const RECTANGLE_MARKER_HEIGHT = 10; diff --git a/assets/src/scripts/d3-rendering/legend.spec.js b/assets/src/scripts/d3-rendering/legend.spec.js index e4ed05caf..c9c374101 100644 --- a/assets/src/scripts/d3-rendering/legend.spec.js +++ b/assets/src/scripts/d3-rendering/legend.spec.js @@ -1,6 +1,7 @@ import {select} from 'd3-selection'; -import {lineMarker, rectangleMarker, textOnlyMarker} from 'd3render/markers'; -import {drawSimpleLegend} from 'd3render/legend'; + +import {drawSimpleLegend} from './legend'; +import {lineMarker, rectangleMarker, textOnlyMarker} from './markers'; describe('Legend module', () => { diff --git a/assets/src/scripts/d3-rendering/loading-indicator.spec.js b/assets/src/scripts/d3-rendering/loading-indicator.spec.js index 751a69332..94fba952a 100644 --- a/assets/src/scripts/d3-rendering/loading-indicator.spec.js +++ b/assets/src/scripts/d3-rendering/loading-indicator.spec.js @@ -1,5 +1,6 @@ import {select} from 'd3-selection'; -import {drawLoadingIndicator} from 'd3render/loading-indicator'; + +import {drawLoadingIndicator} from './loading-indicator'; describe('loading indicator', () => { let div; diff --git a/assets/src/scripts/d3-rendering/markers.spec.js b/assets/src/scripts/d3-rendering/markers.spec.js index 93fa1f6e9..0c0aae385 100644 --- a/assets/src/scripts/d3-rendering/markers.spec.js +++ b/assets/src/scripts/d3-rendering/markers.spec.js @@ -1,5 +1,6 @@ import {select} from 'd3-selection'; -import {lineMarker, circleMarker, rectangleMarker, textOnlyMarker} from 'd3render/markers'; + +import {lineMarker, circleMarker, rectangleMarker, textOnlyMarker} from './markers'; describe('Markers module', () => { diff --git a/assets/src/scripts/d3-rendering/tick-marks.spec.js b/assets/src/scripts/d3-rendering/tick-marks.spec.js index 8c8c39e51..73b7b6a06 100644 --- a/assets/src/scripts/d3-rendering/tick-marks.spec.js +++ b/assets/src/scripts/d3-rendering/tick-marks.spec.js @@ -1,6 +1,6 @@ import {DateTime} from 'luxon'; -import {generateTimeTicks} from 'd3render/tick-marks'; +import {generateTimeTicks} from './tick-marks'; describe('generateTimeTicks', () => { const startTime = 1520538281000; diff --git a/assets/src/scripts/tooltips.js b/assets/src/scripts/d3-rendering/tooltips.js similarity index 91% rename from assets/src/scripts/tooltips.js rename to assets/src/scripts/d3-rendering/tooltips.js index 2d2113dc1..3f7bd5741 100644 --- a/assets/src/scripts/tooltips.js +++ b/assets/src/scripts/d3-rendering/tooltips.js @@ -7,7 +7,7 @@ */ // Required to initialize USWDS components after page load -import components from '../../node_modules/uswds/src/js/components'; +import components from 'uswds/src/js/components'; export const appendTooltip = function(elem, text) { let tooltip = elem.append('div') diff --git a/assets/src/scripts/tooltips.spec.js b/assets/src/scripts/d3-rendering/tooltips.spec.js similarity index 91% rename from assets/src/scripts/tooltips.spec.js rename to assets/src/scripts/d3-rendering/tooltips.spec.js index 8f498c5ac..1d023ca48 100644 --- a/assets/src/scripts/tooltips.spec.js +++ b/assets/src/scripts/d3-rendering/tooltips.spec.js @@ -1,8 +1,9 @@ import {select} from 'd3-selection'; -import {appendTooltip} from 'ui/tooltips'; +import {appendTooltip} from './tooltips'; -describe('tooltips', () => { + +describe('d3-rendering/tooltips', () => { let testDiv; beforeEach(() => { diff --git a/assets/src/scripts/index.spec.js b/assets/src/scripts/index.spec.js index 382e85749..d94bc0b0c 100644 --- a/assets/src/scripts/index.spec.js +++ b/assets/src/scripts/index.spec.js @@ -12,7 +12,6 @@ import 'ui/polyfills'; import 'ui/ajax.spec'; import 'ui/schema.spec'; -import 'ui/tooltips.spec'; import 'ui/utils.spec'; import 'd3render/accessibility.spec'; @@ -25,6 +24,7 @@ import 'd3render/legend.spec'; import 'd3render/loading-indicator.spec'; import 'd3render/markers.spec'; import 'd3render/tick-marks.spec'; +import 'd3render/tooltips.spec'; import 'ui/leaflet-rendering/map.spec'; import 'ui/leaflet-rendering/legend-control.spec'; diff --git a/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js b/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js index 7c39e964b..396668cfd 100644 --- a/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js +++ b/assets/src/scripts/monitoring-location/components/hydrograph/parameters.js @@ -2,7 +2,8 @@ import {line} from 'd3-shape'; import {select} from 'd3-selection'; import config from 'ui/config'; -import {appendTooltip} from 'ui/tooltips'; + +import {appendTooltip} from 'd3render/tooltips'; import {Actions} from 'ml/store/instantaneous-value-time-series-data'; diff --git a/assets/src/scripts/monitoring-location/components/map/flood-slider.js b/assets/src/scripts/monitoring-location/components/map/flood-slider.js index 5a5cf1d98..a3da2ed3b 100644 --- a/assets/src/scripts/monitoring-location/components/map/flood-slider.js +++ b/assets/src/scripts/monitoring-location/components/map/flood-slider.js @@ -1,7 +1,8 @@ import {createStructuredSelector} from 'reselect'; import {link} from 'ui/lib/d3-redux'; -import {appendTooltip} from 'ui/tooltips'; + +import {appendTooltip} from 'd3render/tooltips'; import {getFloodStages, getFloodStageHeight, getFloodGageHeightStageIndex, hasFloodData} from 'ml/selectors/flood-data-selector'; import {Actions} from 'ml/store/flood-inundation'; -- GitLab