Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
feat: export map filename; export image filename (#3760)
Igor Dykhta5bc73e372642
diff --git a/src/actions/src/action-types.ts b/src/actions/src/action-types.tsindex 91f50f093..5155da3ad 100644--- a/src/actions/src/action-types.ts+++ b/src/actions/src/action-types.ts@@ -208,6 +208,7 @@ export const ActionTypes = {SET_EXPORT_MAP_FORMAT: `${ACTION_PREFIX}SET_EXPORT_MAP_FORMAT`,SET_USER_MAPBOX_ACCESS_TOKEN: `${ACTION_PREFIX}SET_USER_MAPBOX_ACCESS_TOKEN`,SET_EXPORT_MAP_HTML_MODE: `${ACTION_PREFIX}SET_EXPORT_MAP_HTML_MODE`,+ SET_EXPORT_MAP_FILE_NAME: `${ACTION_PREFIX}SET_EXPORT_MAP_FILE_NAME`,// uiState > editorSET_EDITOR_MODE: `${ACTION_PREFIX}SET_EDITOR_MODE`,diff --git a/src/actions/src/ui-state-actions.ts b/src/actions/src/ui-state-actions.tsindex db44ec6f7..9afe9f091 100644--- a/src/actions/src/ui-state-actions.ts+++ b/src/actions/src/ui-state-actions.ts@@ -454,6 +454,24 @@ export const setExportHTMLMapMode: ((payload: SetExportHTMLMapModeUpdaterAction['payload']) => ({payload}));+/** SET_EXPORT_MAP_FILE_NAME */+export type SetExportMapFileNameUpdaterAction = {+ payload: string;+};+/**+ * Set the filename used when exporting an HTML or JSON map+ * @memberof uiStateActions+ * @param fileName - download name without extension+ * @public+ */+export const setExportMapFileName: (+ fileName: SetExportMapFileNameUpdaterAction['payload']+) => Merge<SetExportMapFileNameUpdaterAction, {type: typeof ActionTypes.SET_EXPORT_MAP_FILE_NAME}> =+ createAction(+ ActionTypes.SET_EXPORT_MAP_FILE_NAME,+ (payload: SetExportMapFileNameUpdaterAction['payload']) => ({payload})+ );+/** SET_LOCALE */export type SetLocaleUpdaterAction = {payload: {locale: string};diff --git a/src/components/src/modal-container.tsx b/src/components/src/modal-container.tsxindex 4deff7ee5..bcb9e9946 100644--- a/src/components/src/modal-container.tsx+++ b/src/components/src/modal-container.tsx@@ -216,7 +216,10 @@ export default function ModalContainerFactory(_onExportImage = () => {if (!this.props.uiState.exportImage.processing) {- exportImage(this.props.uiState.exportImage, `${this.props.appName}.png`);+ exportImage(+ this.props.uiState.exportImage,+ this.props.uiState.exportImage.fileName || `${this.props.appName}.png`+ );this.props.uiStateActions.cleanupExportImage();this._closeModal();}@@ -230,10 +233,10 @@ export default function ModalContainerFactory(_onExportMap = () => {const {uiState} = this.props;const {format} = uiState.exportMap;- (format === EXPORT_MAP_FORMATS.HTML ? exportHtml : exportJson)(- this.props,- this.props.uiState.exportMap[format] || {}- );+ (format === EXPORT_MAP_FORMATS.HTML ? exportHtml : exportJson)(this.props, {+ ...(this.props.uiState.exportMap[format] || {}),+ fileName: uiState.exportMap.fileName+ });this._closeModal();};@@ -447,6 +450,7 @@ export default function ModalContainerFactory(onChangeExportMapFormat={uiStateActions.setExportMapFormat}onEditUserMapboxAccessToken={uiStateActions.setUserMapboxAccessToken}onChangeExportMapHTMLMode={uiStateActions.setExportHTMLMapMode}+ onChangeExportMapFileName={uiStateActions.setExportMapFileName}/>);modalProps = {diff --git a/src/components/src/modals/export-data-modal.tsx b/src/components/src/modals/export-data-modal.tsxindex b23820c02..a1a7c01bf 100644--- a/src/components/src/modals/export-data-modal.tsx+++ b/src/components/src/modals/export-data-modal.tsx@@ -2,6 +2,7 @@// Copyright contributors to the kepler.gl projectimport React, {useEffect} from 'react';+import styled from 'styled-components';import {injectIntl, IntlShape} from 'react-intl';import {DatasetType, EXPORT_DATA_TYPE_OPTIONS} from '@kepler.gl/constants';@@ -18,6 +19,10 @@ import {} from '../common/styled-components';import {StyledWarning} from './export-map-modal/components';+const CompactExportSection = styled(StyledExportSection)`+ margin: 12px 0;+`;+const getDataRowCount = (datasets: Datasets,selectedDataset: string | undefined,@@ -105,7 +110,7 @@ const ExportDataModalFactory = () => {return (<StyledModalContent className="export-data-modal"><div>- <StyledExportSection>+ <CompactExportSection><div className="description"><div className="title"><FormattedMessage id={'modal.exportData.datasetTitle'} />@@ -125,8 +130,8 @@ const ExportDataModalFactory = () => {))}</select></div>- </StyledExportSection>- <StyledExportSection>+ </CompactExportSection>+ <CompactExportSection><div className="description"><div className="title"><FormattedMessage id={'modal.exportData.dataTypeTitle'} />@@ -147,11 +152,11 @@ const ExportDataModalFactory = () => {</StyledType>))}</div>- </StyledExportSection>- <StyledExportSection>+ </CompactExportSection>+ <CompactExportSection><div className="description"><div className="title">- <FormattedMessage id={'modal.exportData.dataTypeTitle'} />+ <FormattedMessage id={'modal.exportData.filterDataTitle'} /></div><div className="subtitle"><FormattedMessage id={'modal.exportData.filterDataSubtitle'} />@@ -185,7 +190,7 @@ const ExportDataModalFactory = () => {{filtered && <CheckMark />}</StyledFilteredOption></div>- </StyledExportSection>+ </CompactExportSection>{showTiledDatasetWarning ? (<div className="title"><StyledWarning>diff --git a/src/components/src/modals/export-file-name.tsx b/src/components/src/modals/export-file-name.tsxnew file mode 100644index 000000000..71a40f48b--- /dev/null+++ b/src/components/src/modals/export-file-name.tsx@@ -0,0 +1,60 @@+// SPDX-License-Identifier: MIT+// Copyright contributors to the kepler.gl project++import React from 'react';+import styled from 'styled-components';+import {useIntl} from 'react-intl';++import {FormattedMessage} from '@kepler.gl/localization';++import {InputLight, StyledExportSection} from '../common/styled-components';++const FileNameSection = styled(StyledExportSection)<{$compact?: boolean}>`+ ${props => (props.$compact ? 'margin: 8px 0 12px;' : '')}+`;++const StyledFileNameInput = styled(InputLight)`+ width: 100%;+ max-width: 320px;+`;++export type ExportFileNameSectionProps = {+ fileName?: string;+ onChange: (fileName: string) => void;+ inputId?: string;+ compact?: boolean;+};++const ExportFileNameSection: React.FC<ExportFileNameSectionProps> = ({+ fileName = '',+ onChange,+ inputId = 'export-file-name',+ compact+}) => {+ const intl = useIntl();+ return (+ <FileNameSection $compact={compact}>+ <div className="description">+ <div className="title">+ <FormattedMessage id="modal.exportFileName.title" />+ </div>+ <div className="subtitle">+ <FormattedMessage id="modal.exportFileName.subtitle" />+ </div>+ </div>+ <div className="selection">+ <StyledFileNameInput+ id={inputId}+ type="text"+ value={fileName}+ placeholder={intl.formatMessage({id: 'modal.exportFileName.placeholder'})}+ aria-label={intl.formatMessage({id: 'modal.exportFileName.title'})}+ onChange={event => onChange(event.target.value)}+ onMouseDown={event => event.stopPropagation()}+ />+ </div>+ </FileNameSection>+ );+};++export default ExportFileNameSection;diff --git a/src/components/src/modals/export-image-modal.tsx b/src/components/src/modals/export-image-modal.tsxindex ea0910b84..5875e06b5 100644--- a/src/components/src/modals/export-image-modal.tsx+++ b/src/components/src/modals/export-image-modal.tsx@@ -49,6 +49,42 @@ const ImageOptionList = styled.div`gap: 4px;}+ .option-list {+ display: flex;+ flex-direction: column;+ gap: 4px;+ margin-top: 8px;++ .kg-checkbox__label {+ margin-bottom: 0;+ }+ }++ .file-name-input {+ margin-top: 8px;++ input {+ width: 100%;+ padding: 6px 12px;+ border: 1px solid #d3d3d3;+ border-radius: 2px;+ font-size: ${props => props.theme.inputFontSize};+ font-family: inherit;+ height: 32px;+ box-sizing: border-box;++ &:hover {+ border-color: #999;+ }++ &:focus {+ outline: none;+ border-color: #0066cc;+ box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);+ }+ }+ }+.resolution-dropdown {padding: 0px;margin-top: 8px;@@ -125,7 +161,7 @@ const ExportImageModalFactory = () => {cleanupExportImage,intl}) => {- const {legend, charts, ratio, resolution} = exportImage;+ const {legend, charts, ratio, resolution, fileName} = exportImage;const chartsEnabled = Boolean(getApplicationConfig().enableChartsPanel);// Filter resolutions based on selected ratio@@ -175,6 +211,23 @@ const ExportImageModalFactory = () => {return (<StyledModalContent className="export-image-modal"><ImageOptionList>+ <div className="image-option-section">+ <div className="image-option-section-title">+ <FormattedMessage id={'modal.exportFileName.title'} />+ </div>+ <FormattedMessage id={'modal.exportFileName.subtitle'} />+ <div className="file-name-input">+ <input+ id="export-image-file-name"+ type="text"+ value={fileName || ''}+ placeholder={intl.formatMessage({id: 'modal.exportFileName.placeholder'})}+ aria-label={intl.formatMessage({id: 'modal.exportFileName.title'})}+ onChange={event => onUpdateImageSetting({fileName: event.target.value})}+ onMouseDown={event => event.stopPropagation()}+ />+ </div>+ </div><div className="image-option-section"><div className="image-option-section-title"><FormattedMessage id={'modal.exportImage.ratioTitle'} />@@ -245,30 +298,27 @@ const ExportImageModalFactory = () => {)}<div className="image-option-section"><div className="image-option-section-title">- <FormattedMessage id={'modal.exportImage.mapLegendTitle'} />+ <FormattedMessage id={'modal.exportImage.optionsTitle'} /></div>- <Switch- type="checkbox"- id="add-map-legend"- checked={legend}- label={intl.formatMessage({id: 'modal.exportImage.mapLegendAdd'})}- onChange={() => onUpdateImageSetting({legend: !legend})}- />- </div>- {chartsEnabled ? (- <div className="image-option-section">- <div className="image-option-section-title">- <FormattedMessage id={'modal.exportImage.chartsTitle'} />- </div>+ <div className="option-list"><Switchtype="checkbox"- id="add-map-charts"- checked={Boolean(charts)}- label={intl.formatMessage({id: 'modal.exportImage.chartsAdd'})}- onChange={() => onUpdateImageSetting({charts: !charts})}+ id="add-map-legend"+ checked={legend}+ label={intl.formatMessage({id: 'modal.exportImage.mapLegendAdd'})}+ onChange={() => onUpdateImageSetting({legend: !legend})}/>+ {chartsEnabled ? (+ <Switch+ type="checkbox"+ id="add-map-charts"+ checked={Boolean(charts)}+ label={intl.formatMessage({id: 'modal.exportImage.chartsAdd'})}+ onChange={() => onUpdateImageSetting({charts: !charts})}+ />+ ) : null}</div>- ) : null}+ </div></ImageOptionList><ImagePreview exportImage={exportImage} /></StyledModalContent>diff --git a/src/components/src/modals/export-map-modal/export-map-modal.tsx b/src/components/src/modals/export-map-modal/export-map-modal.tsxindex 7c8a3612d..e86bda4b9 100644--- a/src/components/src/modals/export-map-modal/export-map-modal.tsx+++ b/src/components/src/modals/export-map-modal/export-map-modal.tsx@@ -16,14 +16,21 @@ import {import ExportHtmlMapFactory from './export-html-map';import ExportJsonMapFactory from './export-json-map';import {FormattedMessage} from '@kepler.gl/localization';-import {ActionHandler, setExportHTMLMapMode, setUserMapboxAccessToken} from '@kepler.gl/actions';+import {+ ActionHandler,+ setExportHTMLMapMode,+ setExportMapFileName,+ setUserMapboxAccessToken+} from '@kepler.gl/actions';+import ExportFileNameSection from '../export-file-name';interface ExportMapModalFactoryProps {- options?: {format: string};+ options?: {format: string; fileName?: string};config: any;onEditUserMapboxAccessToken: ActionHandler<typeof setUserMapboxAccessToken>;onChangeExportMapHTMLMode?: ActionHandler<typeof setExportHTMLMapMode>;onChangeExportMapFormat?: (format: string) => any;+ onChangeExportMapFileName?: ActionHandler<typeof setExportMapFileName>;mapFormat?: string;}@@ -47,11 +54,18 @@ function ExportMapModalFactory(config = {},onChangeExportMapFormat = NO_OP,onChangeExportMapHTMLMode = NO_OP,+ onChangeExportMapFileName = NO_OP,onEditUserMapboxAccessToken = NO_OP,options = {format: ''}}: ExportMapModalFactoryProps) => (<StyledExportMapModalContent className="export-map-modal"><div style={style}>+ <ExportFileNameSection+ fileName={options.fileName}+ inputId="export-map-file-name"+ compact+ onChange={onChangeExportMapFileName}+ /><StyledExportMapSection><div className="description"><div className="title">diff --git a/src/localization/src/translations/en.ts b/src/localization/src/translations/en.tsindex 468cb0e3b..a1e8ec139 100644--- a/src/localization/src/translations/en.ts+++ b/src/localization/src/translations/en.ts@@ -577,6 +577,11 @@ export default {defaultCancel: 'Cancel',defaultConfirm: 'Confirm'},+ exportFileName: {+ title: 'File name',+ subtitle: 'The file type is added automatically.',+ placeholder: 'kepler.gl'+ },exportImage: {ratioTitle: 'Ratio',ratioDescription: 'Choose the ratio for various usages.',@@ -587,6 +592,7 @@ export default {resolutionTitle: 'Resolution',resolutionDescription: 'High resolution is better for prints.',resolutionPlaceholder: 'Select resolution...',+ optionsTitle: 'Options',mapLegendTitle: 'Map Legend',mapLegendAdd: 'Add legend on map',chartsTitle: 'Charts',diff --git a/src/reducers/src/ui-state-updaters.ts b/src/reducers/src/ui-state-updaters.tsindex 2131f5550..00f4b20f6 100644--- a/src/reducers/src/ui-state-updaters.ts+++ b/src/reducers/src/ui-state-updaters.ts@@ -141,6 +141,7 @@ export const DEFAULT_MAP_CONTROLS: MapControls = (* @property exporting Default: `false`* @property error Default: `false`* @property escapeXhtmlForWebpack Default: from application config (auto-detected: `true` for webpack)+ * @property fileName Default: `''`* @public*/export const DEFAULT_EXPORT_IMAGE: ExportImage = {@@ -167,7 +168,8 @@ export const DEFAULT_EXPORT_IMAGE: ExportImage = {processing: false,error: false,// whether to apply fix for uglify error in dom-to-image (from application config, auto-detects build tool)- escapeXhtmlForWebpack: getApplicationConfig().escapeXhtmlForWebpack+ escapeXhtmlForWebpack: getApplicationConfig().escapeXhtmlForWebpack,+ fileName: ''};export const DEFAULT_LOAD_FILES = {@@ -222,12 +224,14 @@ export const DEFAULT_EXPORT_JSON: ExportJson = {* @property HTML - Default: 'DEFAULT_EXPORT_HTML',* @property JSON - Default: 'DEFAULT_EXPORT_JSON',* @property format - Default: 'HTML',+ * @property fileName Default: `''`,* @public*/export const DEFAULT_EXPORT_MAP: ExportMap = {[EXPORT_MAP_FORMATS.HTML]: DEFAULT_EXPORT_HTML,[EXPORT_MAP_FORMATS.JSON]: DEFAULT_EXPORT_JSON,- format: EXPORT_MAP_FORMATS.HTML+ format: EXPORT_MAP_FORMATS.HTML,+ fileName: ''};/**@@ -774,6 +778,26 @@ export const setExportMapFormatUpdater = (}});+/**+ * Set the filename used when exporting an HTML or JSON map+ * @memberof uiStateUpdaters+ * @param state `uiState`+ * @param action+ * @param action.payload file name without extension+ * @returns nextState+ * @public+ */+export const setExportMapFileNameUpdater = (+ state: UiState,+ {payload: fileName}: UIStateActions.SetExportMapFileNameUpdaterAction+): UiState => ({+ ...state,+ exportMap: {+ ...state.exportMap,+ fileName+ }+});+/*** Set the export html map mode* @param state - `uiState`diff --git a/src/reducers/src/ui-state.ts b/src/reducers/src/ui-state.tsindex 7a33b9a24..fd45bfee1 100644--- a/src/reducers/src/ui-state.ts+++ b/src/reducers/src/ui-state.ts@@ -40,6 +40,7 @@ const actionHandler = {[ActionTypes.SET_EXPORT_MAP_FORMAT]: uiStateUpdaters.setExportMapFormatUpdater,[ActionTypes.SET_EXPORT_MAP_HTML_MODE]: uiStateUpdaters.setExportMapHTMLModeUpdater,+ [ActionTypes.SET_EXPORT_MAP_FILE_NAME]: uiStateUpdaters.setExportMapFileNameUpdater,[ActionTypes.LOAD_FILES]: uiStateUpdaters.loadFilesUpdater,[ActionTypes.LOAD_FILES_ERR]: uiStateUpdaters.loadFilesErrUpdater,diff --git a/src/types/reducers.d.ts b/src/types/reducers.d.tsindex dfa4b174f..e0ae22b70 100644--- a/src/types/reducers.d.ts+++ b/src/types/reducers.d.ts@@ -477,6 +477,7 @@ export declare type ExportImage = {error: Error | false;center: boolean;escapeXhtmlForWebpack?: boolean;+ fileName: string;};export type ExportData = {@@ -497,6 +498,7 @@ export type ExportMap = {HTML: ExportHtml;JSON: ExportJson;format: 'HTML' | 'JSON';+ fileName: string;};export type ExportVideo = {diff --git a/src/utils/src/export-utils.ts b/src/utils/src/export-utils.tsindex bdff49bb1..ba2313266 100644--- a/src/utils/src/export-utils.ts+++ b/src/utils/src/export-utils.ts@@ -96,6 +96,34 @@ export function dataURItoBlob(dataURI: string): Blob {return new Blob([ab], {type: mimeString});}+const ILLEGAL_FILENAME_CHARS = /[/\\?%*:|"<>]/g;+const KNOWN_EXPORT_EXTENSION = /\.(json|html|png|csv|jpe?g|webp)$/i;++/**+ * Turn a user-entered export name into a safe basename.+ * Empty input falls back to `fallback`. Known extensions are stripped so the+ * caller can add the format-specific suffix.+ */+export function getExportFileNameBase(name: string | undefined, fallback: string): string {+ const fallbackBase = fallback.replace(KNOWN_EXPORT_EXTENSION, '').trim() || fallback;+ const raw = (name || '').trim() || fallbackBase;+ const stripped = raw.replace(KNOWN_EXPORT_EXTENSION, '').replace(ILLEGAL_FILENAME_CHARS, '-');+ const cleaned = stripped.replace(/\.+$/, '').trim();+ return cleaned || fallbackBase;+}++/**+ * Resolve a download filename with the given extension.+ */+export function getExportFileName(+ name: string | undefined,+ fallback: string,+ extension: string+): string {+ const cleanExt = extension.replace(/^\./, '');+ return `${getExportFileNameBase(name, fallback)}.${cleanExt}`;+}+export function downloadFile(fileBlob: Blob, fileName: string) {if (isMSEdge(window)) {(window.navigator as any).msSaveOrOpenBlob(fileBlob, fileName);@@ -125,14 +153,18 @@ export function downloadFile(fileBlob: Blob, fileName: string) {* Whether color is rgb* @returns*/-export function exportImage(- uiStateExportImage: ExportImage,- filename = getApplicationConfig().defaultImageName-) {+export function exportImage(uiStateExportImage: ExportImage, filename?: string) {const {imageDataUri} = uiStateExportImage;if (imageDataUri) {const file = dataURItoBlob(imageDataUri);- downloadFile(file, filename);+ downloadFile(+ file,+ getExportFileName(+ filename ?? uiStateExportImage.fileName,+ getApplicationConfig().defaultImageName,+ 'png'+ )+ );}}@@ -167,7 +199,11 @@ export function exportJson(state, options: any = {}) {const map = getMapJSON(state, options);map.info.source = 'kepler.gl';const fileBlob = new Blob([exportToJsonString(map)], {type: 'application/json'});- const fileName = state.appName ? `${state.appName}.json` : getApplicationConfig().defaultJsonName;+ const fileName = getExportFileName(+ options.fileName,+ state.appName ? `${state.appName}.json` : getApplicationConfig().defaultJsonName,+ 'json'+ );downloadFile(fileBlob, fileName);}@@ -184,7 +220,11 @@ export function exportHtml(state, options) {const fileBlob = new Blob([exportMapToHTML(data)], {type: 'text/html'});downloadFile(fileBlob,- state.appName ? `${state.appName}.html` : getApplicationConfig().defaultHtmlName+ getExportFileName(+ options.fileName,+ state.appName ? `${state.appName}.html` : getApplicationConfig().defaultHtmlName,+ 'html'+ ));}diff --git a/src/utils/src/index.ts b/src/utils/src/index.tsindex 3a956353c..2d50dbd46 100644--- a/src/utils/src/index.ts+++ b/src/utils/src/index.ts@@ -94,6 +94,8 @@ export {exportMap,exportToJsonString,default as exporters,+ getExportFileName,+ getExportFileNameBase,getMapJSON,getScaleFromImageSize,isMSEdgediff --git a/test/node/reducers/ui-state-test.js b/test/node/reducers/ui-state-test.jsindex 0247ca64f..0a6f9ec0b 100644--- a/test/node/reducers/ui-state-test.js+++ b/test/node/reducers/ui-state-test.js@@ -15,6 +15,7 @@ import {setExportSelectedDataset,setExportDataType,setExportFiltered,+ setExportMapFileName,startExportingImage,addNotification,removeNotification,@@ -257,6 +258,22 @@ test('#uiStateReducer -> SET_EXPORT_DATA_TYPE', t => {t.end();});+test('#uiStateReducer -> SET_EXPORT_MAP_FILE_NAME', t => {+ const newReducer = reducer(INITIAL_UI_STATE, setExportMapFileName('downtown-map'));++ const expectedState = {+ ...INITIAL_UI_STATE,+ exportMap: {+ ...INITIAL_UI_STATE.exportMap,+ fileName: 'downtown-map'+ }+ };++ t.deepEqual(newReducer, expectedState, 'should set the export map file name');++ t.end();+});+test('#uiStateReducer -> SET_EXPORT_FILTERED', t => {const newReducer = reducer(INITIAL_UI_STATE, setExportFiltered(false));diff --git a/test/node/utils/export-utils-test.js b/test/node/utils/export-utils-test.jsindex adf442a34..efb00208b 100644--- a/test/node/utils/export-utils-test.js+++ b/test/node/utils/export-utils-test.js@@ -10,7 +10,9 @@ import {exportToJsonString,getScaleFromImageSize,isMSEdge,- calculateExportImageSize+ calculateExportImageSize,+ getExportFileName,+ getExportFileNameBase} from '@kepler.gl/utils';import {EXPORT_IMG_RATIOS, RESOLUTIONS} from '@kepler.gl/constants';@@ -170,3 +172,33 @@ test('exportUtils -> exportToJsonString', t => {t.equal(exportToJsonString({test: 1}), '{"test":1}', 'Should convert object to string');t.end();});++test('exportUtils -> getExportFileName', t => {+ t.equal(+ getExportFileName('', 'kepler.gl.json', 'json'),+ 'kepler.gl.json',+ 'empty name uses fallback'+ );+ t.equal(+ getExportFileName('census-2020', 'kepler.gl.json', 'json'),+ 'census-2020.json',+ 'appends format'+ );+ t.equal(+ getExportFileName('census-2020.json', 'kepler.gl.json', 'json'),+ 'census-2020.json',+ 'strips a matching extension before adding it again'+ );+ t.equal(+ getExportFileName('census-2020.html', 'kepler.gl.html', 'html'),+ 'census-2020.html',+ 'strips html extension typed by the user'+ );+ t.equal(+ getExportFileName('bad/name:file', 'kepler.gl.png', 'png'),+ 'bad-name-file.png',+ 'replaces illegal filename characters'+ );+ t.equal(getExportFileNameBase('', 'kepler.gl'), 'kepler.gl', 'base fallback is unchanged');+ t.end();+});