Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.
[Enhancement] better handling provider tile update (#1000)
Shan Hec6586c88cd6f
diff --git a/src/components/modals/image-modal-container.js b/src/components/modals/image-modal-container.jsindex 3c2c52e1d..7909501c0 100644--- a/src/components/modals/image-modal-container.js+++ b/src/components/modals/image-modal-container.js@@ -24,9 +24,13 @@ import get from 'lodash.get';import {MAP_THUMBNAIL_DIMENSION, EXPORT_IMG_RATIOS} from 'constants/default-settings';+/**+ * A wrapper component in modals contain a image preview of the map with cloud providers+ * It sets export image size based on provider thumbnail size+ * @component+ */export default class ImageModalContainer extends Component {static propTypes = {- onSetCloudProvider: PropTypes.func.isRequired,onUpdateImageSetting: PropTypes.func.isRequired,cloudProviders: PropTypes.arrayOf(PropTypes.object),currentProvider: PropTypes.string@@ -38,18 +42,17 @@ export default class ImageModalContainer extends Component {};componentDidMount() {- this._updateThumbSize();- this._setDefaultProvider();+ this._updateThumbSize(true);}componentDidUpdate(prevProps) {// set thumbnail size if provider changes- if (this.props.currentProvider !== prevProps.currentProvider) {+ if (this.props.currentProvider !== prevProps.currentProvider && this.props.currentProvider) {this._updateThumbSize();}}- _updateThumbSize() {+ _updateThumbSize(initialMount) {if (this.props.currentProvider && this.props.cloudProviders.length) {const provider = this.props.cloudProviders.find(p => p.name === this.props.currentProvider);@@ -61,18 +64,12 @@ export default class ImageModalContainer extends Component {legend: false});}- }- }-- _setDefaultProvider() {- if (!this.props.currentProvider && this.props.cloudProviders.length) {- const connected = this.props.cloudProviders.find(- p => typeof p.getAccessToken === 'function' && p.getAccessToken()- );-- if (connected) {- this.props.onSetCloudProvider(connected.name);- }+ } else if (initialMount) {+ this.props.onUpdateImageSetting({+ mapW: MAP_THUMBNAIL_DIMENSION.width,+ mapH: MAP_THUMBNAIL_DIMENSION.height,+ ratio: EXPORT_IMG_RATIOS.CUSTOM+ });}}diff --git a/src/components/modals/load-storage-map.js b/src/components/modals/load-storage-map.jsindex 403ec88db..55d6f6d7a 100644--- a/src/components/modals/load-storage-map.js+++ b/src/components/modals/load-storage-map.js@@ -26,8 +26,11 @@ import LoadingDialog from './loading-dialog';import {Button} from 'components/common/styled-components';import CloudTile from './cloud-tile';import {Base, ArrowLeft} from 'components/common/icons';+import ProviderModalContainer from './provider-modal-container';-const StyledProviderSection = styled.div`+const StyledProviderSection = styled.div.attrs({+ className: 'provider-selection'+})`display: flex;`;@@ -215,17 +218,23 @@ const VisualizationItem = ({vis, onClick}) => {</StyledVisualizationItem>);};-const ProviderSelect = ({cloudProviders, onSetCloudProvider, currentProvider}) =>++export const ProviderSelect = ({+ cloudProviders = [],+ onSelect,+ onSetCloudProvider,+ currentProvider+}) =>cloudProviders.length ? (<StyledProviderSection>{cloudProviders.map(provider => (<CloudTilekey={provider.name}- onSelect={() => onSetCloudProvider(provider.name)}+ onSelect={() => onSelect(provider.name)}onSetCloudProvider={onSetCloudProvider}cloudProvider={provider}isSelected={provider.name === currentProvider}- isConnected={Boolean(provider.getAccessToken())}+ isConnected={Boolean(provider.getAccessToken && provider.getAccessToken())}/>))}</StyledProviderSection>@@ -235,9 +244,14 @@ const ProviderSelect = ({cloudProviders, onSetCloudProvider, currentProvider}) =function LoadStorageMapFactory() {class LoadStorageMap extends Component {+ state = {+ showProviderSelect: true+ };+componentDidMount() {this._getSavedMaps();}+componentDidUpdate(prevProps) {if (prevProps.currentProvider !== this.props.currentProvider) {this._getSavedMaps();@@ -253,6 +267,7 @@ function LoadStorageMapFactory() {const provider = this._getProvider();if (provider) {this.props.getSavedMaps(provider);+ this.setState({showProviderSelect: false});}}@@ -262,11 +277,23 @@ function LoadStorageMapFactory() {provider});}++ _clickBack = () => {+ this.setState({showProviderSelect: true});+ };++ _selectProvider = providerName => {+ this.props.onSetCloudProvider(providerName);+ const provider = (this.props.cloudProviders || []).find(p => p.name === providerName);+ this.props.getSavedMaps(provider);+ this.setState({showProviderSelect: false});+ };+render() {const {visualizations,cloudProviders,- currentProvider = null,+ currentProvider,isProviderLoading,onSetCloudProvider} = this.props;@@ -274,9 +301,14 @@ function LoadStorageMapFactory() {const provider = this._getProvider();return (- <div>- {!provider ? (+ <ProviderModalContainer+ onSetCloudProvider={onSetCloudProvider}+ cloudProviders={cloudProviders}+ currentProvider={currentProvider}+ >+ {this.state.showProviderSelect ? (<ProviderSelect+ onSelect={this._selectProvider}cloudProviders={cloudProviders}onSetCloudProvider={onSetCloudProvider}currentProvider={currentProvider}@@ -292,7 +324,7 @@ function LoadStorageMapFactory() {<StyledVisualizationSection><StyledStorageHeader><StyledBackBtn>- <Button link onClick={() => onSetCloudProvider(null)}>+ <Button link onClick={this._clickBack}><ArrowLeft height="14px" />Back</Button>@@ -332,7 +364,7 @@ function LoadStorageMapFactory() {)}</>)}- </div>+ </ProviderModalContainer>);}}diff --git a/src/components/modals/modal-tabs.js b/src/components/modals/modal-tabs.jsindex 481bdedef..4035ad4da 100644--- a/src/components/modals/modal-tabs.js+++ b/src/components/modals/modal-tabs.js@@ -73,7 +73,7 @@ const StyledLoadDataModalTabItem = styled.div`const noop = () => {};-const ModalTabItem = ({currentMethod, method, toggleMethod}) => {+export const ModalTabItem = ({currentMethod, method, toggleMethod}) => {const onClick = useCallback(() => toggleMethod(method), [method, toggleMethod]);return method.tabElementType ? (diff --git a/src/components/modals/provider-modal-container.js b/src/components/modals/provider-modal-container.jsnew file mode 100644index 000000000..629513b0b--- /dev/null+++ b/src/components/modals/provider-modal-container.js@@ -0,0 +1,60 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React, {Component} from 'react';+import PropTypes from 'prop-types';++/**+ * A wrapper component in modals contain cloud providers.+ * It set default provider by checking which provider has logged in+ * @component+ */+export default class ProviderModalContainer extends Component {+ static propTypes = {+ onSetCloudProvider: PropTypes.func.isRequired,+ cloudProviders: PropTypes.arrayOf(PropTypes.object),+ currentProvider: PropTypes.string+ };++ static defaultProps = {+ cloudProviders: [],+ currentProvider: null+ };++ componentDidMount() {+ this._setDefaultProvider();+ }++ _setDefaultProvider() {+ if (!this.props.currentProvider && this.props.cloudProviders.length) {+ const connected = this.props.cloudProviders.find(+ p => typeof p.getAccessToken === 'function' && p.getAccessToken()+ );++ if (connected && typeof this.props.onSetCloudProvider === 'function') {+ this.props.onSetCloudProvider(connected.name);+ }+ }+ }++ render() {+ return <>{this.props.children}</>;+ }+}diff --git a/src/components/modals/save-map-modal.js b/src/components/modals/save-map-modal.jsindex 5f9db0054..45554df6a 100644--- a/src/components/modals/save-map-modal.js+++ b/src/components/modals/save-map-modal.js@@ -23,6 +23,8 @@ import PropTypes from 'prop-types';import styled from 'styled-components';import CloudTile from './cloud-tile';import ImageModalContainer from './image-modal-container';+import ProviderModalContainer from './provider-modal-container';+import StatusPanel, {UploadAnimation} from './status-panel';import {MAP_THUMBNAIL_DIMENSION, MAP_INFO_CHARACTER} from 'constants/default-settings';@@ -138,7 +140,8 @@ function SaveMapModalFactory() {currentProvider: null,providerError: null,isProviderLoading: false,- onSetCloudProvider: nop+ onSetCloudProvider: nop,+ onUpdateImageSetting: nop};_onChangeInput = (key, e) => {@@ -165,80 +168,85 @@ function SaveMapModalFactory() {: null;return (- <ImageModalContainer- currentProvider={currentProvider}- cloudProviders={cloudProviders}- onUpdateImageSetting={onUpdateImageSetting}+ <ProviderModalContaineronSetCloudProvider={onSetCloudProvider}+ cloudProviders={cloudProviders}+ currentProvider={currentProvider}>- <StyledSaveMapModal>- <StyledModalContent className="save-map-modal-content">- <StyledExportSection disabled={isProviderLoading}>- <div className="description">- <div className="title">Cloud storage</div>- <div className="subtitle">Login save map to your personal cloud storage</div>- </div>- <div className="selection">- {cloudProviders.map(cloudProvider => (- <CloudTile- key={cloudProvider.name}- onSelect={() => onSetCloudProvider(cloudProvider.name)}- onSetCloudProvider={onSetCloudProvider}- cloudProvider={cloudProvider}- isSelected={cloudProvider.name === currentProvider}- isConnected={Boolean(- cloudProvider.getAccessToken && cloudProvider.getAccessToken()- )}- />- ))}- </div>- </StyledExportSection>- {provider && provider.getManagementUrl && (- <StyledExportSection style={{margin: '2px 0'}}>- <div className="description" />+ <ImageModalContainer+ currentProvider={currentProvider}+ cloudProviders={cloudProviders}+ onUpdateImageSetting={onUpdateImageSetting}+ >+ <StyledSaveMapModal>+ <StyledModalContent className="save-map-modal-content">+ <StyledExportSection disabled={isProviderLoading}>+ <div className="description">+ <div className="title">Cloud storage</div>+ <div className="subtitle">Login save map to your personal cloud storage</div>+ </div><div className="selection">- <a- key={1}- href={provider.getManagementUrl()}- target="_blank"- rel="noopener noreferrer"- style={{textDecoration: 'underline'}}- >- Go to your Kepler.gl {provider.displayName} page- </a>+ {cloudProviders.map(cloudProvider => (+ <CloudTile+ key={cloudProvider.name}+ onSelect={() => onSetCloudProvider(cloudProvider.name)}+ onSetCloudProvider={onSetCloudProvider}+ cloudProvider={cloudProvider}+ isSelected={cloudProvider.name === currentProvider}+ isConnected={Boolean(+ cloudProvider.getAccessToken && cloudProvider.getAccessToken()+ )}+ />+ ))}</div></StyledExportSection>- )}- <StyledExportSection>- <div className="description image-preview-panel">- <ImagePreview- exportImage={exportImage}- width={MAP_THUMBNAIL_DIMENSION.width}- showDimension={false}- />- </div>- {isProviderLoading ? (- <div className="selection map-saving-animation">- <UploadAnimation icon={provider && provider.icon} />+ {provider && provider.getManagementUrl && (+ <StyledExportSection style={{margin: '2px 0'}}>+ <div className="description" />+ <div className="selection">+ <a+ key={1}+ href={provider.getManagementUrl()}+ target="_blank"+ rel="noopener noreferrer"+ style={{textDecoration: 'underline'}}+ >+ Go to your Kepler.gl {provider.displayName} page+ </a>+ </div>+ </StyledExportSection>+ )}+ <StyledExportSection>+ <div className="description image-preview-panel">+ <ImagePreview+ exportImage={exportImage}+ width={MAP_THUMBNAIL_DIMENSION.width}+ showDimension={false}+ /></div>- ) : (- <MapInfoPanel- mapInfo={mapInfo}- characterLimits={characterLimits}- onChangeInput={this._onChangeInput}+ {isProviderLoading ? (+ <div className="selection map-saving-animation">+ <UploadAnimation icon={provider && provider.icon} />+ </div>+ ) : (+ <MapInfoPanel+ mapInfo={mapInfo}+ characterLimits={characterLimits}+ onChangeInput={this._onChangeInput}+ />+ )}+ </StyledExportSection>+ {providerError ? (+ <StatusPanel+ isLoading={false}+ error={providerError}+ providerIcon={provider && provider.icon}/>- )}- </StyledExportSection>- {providerError ? (- <StatusPanel- isLoading={false}- error={providerError}- providerIcon={provider && provider.icon}- />- ) : null}- </StyledModalContent>- </StyledSaveMapModal>- </ImageModalContainer>+ ) : null}+ </StyledModalContent>+ </StyledSaveMapModal>+ </ImageModalContainer>+ </ProviderModalContainer>);}}diff --git a/src/components/modals/share-map-modal.js b/src/components/modals/share-map-modal.jsindex ca38fa8fa..4725718f3 100644--- a/src/components/modals/share-map-modal.js+++ b/src/components/modals/share-map-modal.js@@ -23,6 +23,7 @@ import styled, {ThemeProvider} from 'styled-components';import {CopyToClipboard} from 'react-copy-to-clipboard';import {themeLT} from 'styles/base';import ImageModalContainer from './image-modal-container';+import ProviderModalContainer from './provider-modal-container';import {StyledModalContent,@@ -92,7 +93,8 @@ export default function ShareMapUrlModalFactory() {currentProvider: null,providerError: null,successInfo: {},- onSetCloudProvider: nop+ onSetCloudProvider: nop,+ onUpdateImageSetting: nop};render() {@@ -114,76 +116,81 @@ export default function ShareMapUrlModalFactory() {return (<ThemeProvider theme={themeLT}>- <ImageModalContainer- currentProvider={currentProvider}- cloudProviders={cloudProviders}- onUpdateImageSetting={onUpdateImageSetting}+ <ProviderModalContaineronSetCloudProvider={onSetCloudProvider}+ cloudProviders={cloudProviders}+ currentProvider={currentProvider}>- <StyledShareMapModal className="export-cloud-modal">- <StyledInnerDiv>- <StyledExportSection>- <div className="description">- <div className="title">Share Map Url</div>- <div className="subtitle">Generate a map url to share with others</div>- </div>- <div className="selection">- <div className="title warning">{SHARE_DISCLAIMER}</div>- </div>- </StyledExportSection>- <StyledExportSection disabled={isProviderLoading}>- <div className="description">- <div className="title">Cloud storage</div>- <div className="subtitle">- Login and upload map data to your personal cloud storage- </div>- </div>- <div className="selection">- {cloudProviders.map(cloudProvider => (- <CloudTile- key={cloudProvider.name}- onSelect={() => onExport(cloudProvider)}- onSetCloudProvider={onSetCloudProvider}- cloudProvider={cloudProvider}- actionName="Upload"- isSelected={cloudProvider.name === currentProvider}- isConnected={Boolean(cloudProvider.getAccessToken())}- isReady={isReady}- />- ))}- </div>- </StyledExportSection>- {isProviderLoading || providerError ? (- <StatusPanel- isLoading={isProviderLoading}- error={providerError}- providerIcon={provider && provider.icon}- />- ) : null}- {shareUrl && (+ <ImageModalContainer+ currentProvider={currentProvider}+ cloudProviders={cloudProviders}+ onUpdateImageSetting={onUpdateImageSetting}+ >+ <StyledShareMapModal className="export-cloud-modal">+ <StyledInnerDiv><StyledExportSection><div className="description">- <div className="title">Share Url</div>+ <div className="title">Share Map Url</div>+ <div className="subtitle">Generate a map url to share with others</div>+ </div>+ <div className="selection">+ <div className="title warning">{SHARE_DISCLAIMER}</div>+ </div>+ </StyledExportSection>+ <StyledExportSection disabled={isProviderLoading}>+ <div className="description">+ <div className="title">Cloud storage</div>+ <div className="subtitle">+ Login and upload map data to your personal cloud storage+ </div></div><div className="selection">- <SharingUrl key={0} url={shareUrl} />- {provider && folderLink && (- <a- key={1}- href={folderLink}- target="_blank"- rel="noopener noreferrer"- style={{textDecoration: 'underline'}}- >- Go to your Kepler.gl {provider.displayName} page- </a>- )}+ {cloudProviders.map(cloudProvider => (+ <CloudTile+ key={cloudProvider.name}+ onSelect={() => onExport(cloudProvider)}+ onSetCloudProvider={onSetCloudProvider}+ cloudProvider={cloudProvider}+ actionName="Upload"+ isSelected={cloudProvider.name === currentProvider}+ isConnected={Boolean(cloudProvider.getAccessToken())}+ isReady={isReady}+ />+ ))}</div></StyledExportSection>- )}- </StyledInnerDiv>- </StyledShareMapModal>- </ImageModalContainer>+ {isProviderLoading || providerError ? (+ <StatusPanel+ isLoading={isProviderLoading}+ error={providerError}+ providerIcon={provider && provider.icon}+ />+ ) : null}+ {shareUrl && (+ <StyledExportSection>+ <div className="description">+ <div className="title">Share Url</div>+ </div>+ <div className="selection">+ <SharingUrl key={0} url={shareUrl} />+ {provider && folderLink && (+ <a+ key={1}+ href={folderLink}+ target="_blank"+ rel="noopener noreferrer"+ style={{textDecoration: 'underline'}}+ >+ Go to your Kepler.gl {provider.displayName} page+ </a>+ )}+ </div>+ </StyledExportSection>+ )}+ </StyledInnerDiv>+ </StyledShareMapModal>+ </ImageModalContainer>+ </ProviderModalContainer></ThemeProvider>);}diff --git a/test/browser/components/modals/index.js b/test/browser/components/modals/index.jsindex c5d100829..57546890f 100644--- a/test/browser/components/modals/index.js+++ b/test/browser/components/modals/index.js@@ -21,3 +21,6 @@import './data-table-modal-test';import './save-map-modal-test';import './share-map-modal-test';+import './share-map-modal-test';+import './load-data-modal-test';+import './load-storage-map-test';diff --git a/test/browser/components/modals/load-data-modal-test.js b/test/browser/components/modals/load-data-modal-test.jsnew file mode 100644index 000000000..086069ffc--- /dev/null+++ b/test/browser/components/modals/load-data-modal-test.js@@ -0,0 +1,69 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React from 'react';+import test from 'tape';+import {mountWithTheme} from 'test/helpers/component-utils';+import LoadDataModalFactory from 'components/modals/load-data-modal';+import {ModalTabItem} from 'components/modals/modal-tabs';+import LoadStorageMapFactory from 'components/modals/load-storage-map';++import {appInjector} from 'components/container';++const LoadDataModal = appInjector.get(LoadDataModalFactory);+const LoadStorageMap = appInjector.get(LoadStorageMapFactory);++test('Components -> LoadDataModal.mount', t => {+ // mount+ let wrapper;+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(<LoadDataModal />);+ }, 'Show not fail without props');++ t.equal(wrapper.find('.file-uploader').length, 3, 'should render FileUpload');+ t.equal(wrapper.find('.load-data-modal__tab').length, 3, 'should render ModalTabs');+ t.equal(wrapper.find(LoadStorageMap).length, 0, 'should not render LoadStorageMap');+ t.end();+});++test('Components -> LoadDataModal -> custom loading method', t => {+ // mount+ const MockComp = () => <div className="taro" />;+ const MockTabComp = () => <div className="taro's tab" />;++ const loadingMethods = [+ {+ id: 'taro',+ label: 'Taro and Blue',+ elementType: MockComp,+ tabElementType: MockTabComp+ }+ ];++ let wrapper;+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(<LoadDataModal loadingMethods={loadingMethods} />);+ }, 'Show not fail without props');++ t.equal(wrapper.find(ModalTabItem).length, 1, 'should render 1 ModalTabItem');+ t.equal(wrapper.find(MockComp).length, 1, 'should render MockComp by default');+ t.equal(wrapper.find(MockTabComp).length, 1, 'should render MockTabComp');+ t.end();+});diff --git a/test/browser/components/modals/load-storage-map-test.js b/test/browser/components/modals/load-storage-map-test.jsnew file mode 100644index 000000000..fb50a2c75--- /dev/null+++ b/test/browser/components/modals/load-storage-map-test.js@@ -0,0 +1,79 @@+// Copyright (c) 2020 Uber Technologies, Inc.+//+// Permission is hereby granted, free of charge, to any person obtaining a copy+// of this software and associated documentation files (the "Software"), to deal+// in the Software without restriction, including without limitation the rights+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+// copies of the Software, and to permit persons to whom the Software is+// furnished to do so, subject to the following conditions:+//+// The above copyright notice and this permission notice shall be included in+// all copies or substantial portions of the Software.+//+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN+// THE SOFTWARE.++import React from 'react';+import test from 'tape';+import {mountWithTheme} from 'test/helpers/component-utils';+import sinon from 'sinon';+import LoadStorageMapFactory from 'components/modals/load-storage-map';++import MockProvider from 'test/helpers/mock-provider';+import {appInjector} from 'components/container';++const mockProvider = new MockProvider();++const LoadStorageMap = appInjector.get(LoadStorageMapFactory);++test('Components -> LoadStorageMap.mount', t => {+ // mount+ const getSavedMaps = sinon.spy();++ let wrapper;+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(+ <LoadStorageMap+ getSavedMaps={getSavedMaps}+ cloudProviders={[mockProvider]}+ currentProvider={null}+ onSetCloudProvider={() => {}}+ />+ );+ }, 'Show not fail without props');++ t.equal(wrapper.find('.provider-selection').length, 1, 'should render ProviderSelect');++ t.end();+});++test('Components -> LoadStorageMap.mount', t => {+ // mount+ const getSavedMaps = sinon.spy();++ let wrapper;+ t.doesNotThrow(() => {+ wrapper = mountWithTheme(+ <LoadStorageMap+ getSavedMaps={getSavedMaps}+ cloudProviders={[mockProvider]}+ currentProvider="taro"+ onSetCloudProvider={() => {}}+ />+ );+ }, 'Show not fail without props');++ t.equal(wrapper.find('.provider-selection').length, 0, 'should not render ProviderSelect');++ t.deepEqual(+ getSavedMaps.args,+ [[mockProvider]],+ 'should call getSavedMaps when mount with mockProvider'+ );+ t.end();+});