Skip to content

Commit

Permalink
Merge 12b09ad into 9751de2
Browse files Browse the repository at this point in the history
  • Loading branch information
igorarkhipenko committed Jun 10, 2020
2 parents 9751de2 + 12b09ad commit 08a95fb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 171 deletions.
1 change: 1 addition & 0 deletions src/components/LocationSelector/LocationSelector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ $modal-min-height: 400px;
}

&__mainTextButton {
background-color: white;
display: inline-block;
text-align: left;
padding-left: 0;
Expand Down
2 changes: 1 addition & 1 deletion src/components/LocationSelector/LocationSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ export const LocationSelector: React.FC<Props> = (props) => {
isFocused={isWrapperFocused}
showClearButton={hasLocationsSelected}
clearLabel={clearLabel}
onClick={handleOpenModal}
onMouseUp={handleOpenModal}
onClear={onRemoveAllLocations}
>
<FaMapMarkerAlt {...elem('icon', props)} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('LocationSelector component', () => {
it('should open and close modal when requested', () => {
expect(wrapper.find('Modal').at(0).props().isOpen).toBeFalsy();

wrapper.find('FieldWrapper').simulate('click');
wrapper.find('FieldWrapper').simulate('mouseUp');
expect(wrapper.find('Modal').at(0).props().isOpen).toBeTruthy();

// Since JSDom cannot click outside of component,
Expand All @@ -110,7 +110,7 @@ describe('LocationSelector component', () => {
cb(geocodeResponse.results, geocodeResponse.status);
});

wrapper.find('FieldWrapper').simulate('click');
wrapper.find('FieldWrapper').simulate('mouseUp');

// Since LocationSelectorDialog is not rendered due to LoadScriptNext not resolving
// we hack the callback by calling it directly on LocationSelectorDialogWithGoogleLoader
Expand All @@ -134,7 +134,7 @@ describe('LocationSelector component', () => {
description: location.description,
radius: location.radius * 1000,
}));
wrapper.find('FieldWrapper').simulate('click');
wrapper.find('FieldWrapper').simulate('mouseUp');

// Since LocationSelectorDialog is not rendered due to LoadScriptNext not resolving
// we hack the callback by calling it directly on LocationSelectorDialogWithGoogleLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ exports[`LocationSelector component should render LocationSelector properly when
<FieldWrapper
className="LocationSelector__mainTextButtonWrapper"
clearLabel="Clear"
isFocused={true}
isFocused={false}
onClear={[MockFunction]}
onClick={[Function]}
onMouseUp={[Function]}
showClearButton={true}
>
<div
className="FieldWrapper FieldWrapper--isFocused LocationSelector__mainTextButtonWrapper"
onClick={[Function]}
className="FieldWrapper LocationSelector__mainTextButtonWrapper"
onMouseUp={[Function]}
>
<div
className="FieldWrapper__content"
Expand Down Expand Up @@ -140,7 +140,7 @@ exports[`LocationSelector component should render LocationSelector properly when
ariaHideApp={false}
className="LocationSelector__modal"
contentLabel="Location selection dialog"
isOpen={true}
isOpen={false}
onRequestClose={[Function]}
overlayClassName={null}
portalClassName={null}
Expand All @@ -157,7 +157,7 @@ exports[`LocationSelector component should render LocationSelector properly when
}
closeTimeoutMS={300}
contentLabel="Location selection dialog"
isOpen={true}
isOpen={false}
onRequestClose={[Function]}
overlayClassName={
Object {
Expand All @@ -178,39 +178,7 @@ exports[`LocationSelector component should render LocationSelector properly when
containerInfo={
<div
class="ReactModalPortal"
>
<div
class="Modal__overlay Modal__overlay--entered"
>
<div
aria-label="Location selection dialog"
class="Modal__content LocationSelector__modal Modal__content--entered"
role="dialog"
tabindex="-1"
>
<div
aria-busy="true"
aria-hidden="false"
class="LoadingSpinner LoadingSpinner--centerIn_parent"
role="status"
>
<svg
class="LoadingSpinner__svg"
viewBox="0,0,44,44"
>
<circle
class="LoadingSpinner__path LoadingSpinner__path--context_brand"
cx="22"
cy="22"
fill="none"
r="20"
stroke-width="4"
/>
</svg>
</div>
</div>
</div>
</div>
/>
}
>
<ModalPortal
Expand Down Expand Up @@ -251,7 +219,7 @@ exports[`LocationSelector component should render LocationSelector properly when
},
}
}
isOpen={true}
isOpen={false}
onRequestClose={[Function]}
overlayClassName={
Object {
Expand All @@ -273,131 +241,7 @@ exports[`LocationSelector component should render LocationSelector properly when
"overlay": Object {},
}
}
>
<div
className="Modal__overlay Modal__overlay--entered"
onClick={[Function]}
onMouseDown={[Function]}
style={Object {}}
>
<div
aria-label="Location selection dialog"
className="Modal__content LocationSelector__modal Modal__content--entered"
onClick={[Function]}
onKeyDown={[Function]}
onMouseDown={[Function]}
onMouseUp={[Function]}
role="dialog"
style={Object {}}
tabIndex="-1"
>
<LocationSelectorDialogWithGoogleLoader
additionalGoogleProps={Object {}}
apiKey="apiKey"
country="NL"
doneLabel="doneLabel"
getMarkers={[Function]}
hasRadius={true}
inputPlaceholder="inputPlaceholder"
language="en"
maxRadius={100}
minRadius={1}
noSuggestionsPlaceholder="noSuggestionsPlaceholder"
onAddLocation={[Function]}
onCloseModal={[Function]}
onLocationAutocompleteError={[MockFunction]}
onRemoveAllLocations={[MockFunction]}
onRemoveLocation={[MockFunction]}
onUpdateLocation={[MockFunction]}
placeTypes={
Array [
"(regions)",
]
}
radiusStep={1}
renderRadiusLabel={[Function]}
selectedLocations={
Array [
Object {
"center": Object {
"lat": 52.3666969,
"lng": 4.894539799999961,
},
"description": "Amsterdam",
"id": "ajdo-219a-j19v-0491",
"radius": 42,
"sliderLabel": "42km",
},
Object {
"center": Object {
"lat": 52.09073739999999,
"lng": 5.121420100000023,
},
"description": "Utrecht",
"id": "ajdo-219a-j19v-0492",
"radius": 20,
"sliderLabel": "20km",
},
]
}
showCountryInSuggestions={true}
withoutLocationCards={false}
>
<Memo(LoadScriptNext)
googleMapsApiKey="apiKey"
language="en"
libraries={
Array [
"places",
]
}
loadingElement={
<LoadingSpinner
centerIn="parent"
context="brand"
hidden={false}
/>
}
>
<LoadingSpinner
centerIn="parent"
context="brand"
hidden={false}
>
<div
aria-busy={true}
aria-hidden={false}
className="LoadingSpinner LoadingSpinner--centerIn_parent"
role="status"
>
<svg
className="LoadingSpinner__svg"
style={null}
viewBox={
Array [
0,
0,
44,
44,
]
}
>
<circle
className="LoadingSpinner__path LoadingSpinner__path--context_brand"
cx="22"
cy="22"
fill="none"
r="20"
strokeWidth="4"
/>
</svg>
</div>
</LoadingSpinner>
</Memo(LoadScriptNext)>
</LocationSelectorDialogWithGoogleLoader>
</div>
</div>
</ModalPortal>
/>
</Portal>
</Modal>
</Modal>
Expand Down Expand Up @@ -468,12 +312,12 @@ exports[`LocationSelector component should render LocationSelector propertly whe
clearLabel="Clear"
isFocused={false}
onClear={[MockFunction]}
onClick={[Function]}
onMouseUp={[Function]}
showClearButton={true}
>
<div
className="FieldWrapper LocationSelector__mainTextButtonWrapper"
onClick={[Function]}
onMouseUp={[Function]}
>
<div
className="FieldWrapper__content"
Expand Down

0 comments on commit 08a95fb

Please sign in to comment.