Skip to content

Commit

Permalink
Fixing tests for Map component,update test configurations,add test co…
Browse files Browse the repository at this point in the history
…verage.
  • Loading branch information
jedgar1mx committed Feb 6, 2024
1 parent a726abe commit 65b1860
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion build/assets/js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"deploy-storybook": "storybook-to-ghpages",
"test-storybook": "test-storybook",
"test-storybook": "test-storybook --maxWorkers=2 --coverage",
"release": "auto shipit --base-branch=dev",
"chromatic": "chromatic --exit-zero-on-changes"
},
Expand Down
46 changes: 25 additions & 21 deletions src/components/organisms/Map/Map.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,25 +80,28 @@ export default class Map extends HTMLElement {
}

const mapData = JSON.parse(this.getAttribute('data-map-data'));
this.map.addSource('data-points', {
type: 'geojson',
data: mapData.data,
});
this.map.addLayer({
id: 'data-points',
type: 'circle',
source: 'data-points',
paint: {
'circle-radius': {
base: 5,
stops: [
[12, 5],
[22, 120],
],
if(mapData){
this.map.addSource('data-points', {
type: 'geojson',
data: mapData.data,
});
this.map.addLayer({
id: 'data-points',
type: 'circle',
source: 'data-points',
paint: {
'circle-radius': {
base: 5,
stops: [
[12, 5],
[22, 120],
],
},
'circle-color': '#004544',
},
'circle-color': '#004544',
},
});
});
}

});
// Creating this temp variable for workaround with dealing with "this" encapsulation
// TODO: See CityOfDetroit/detroitmi#1099
Expand All @@ -124,10 +127,11 @@ export default class Map extends HTMLElement {
const mapMode = this.getAttribute('data-map-mode');
switch (mapMode) {
case 'my-home-info': {
const app = document.getElementsByTagName('my-home-info');
const parentComponentName = this.getAttribute('data-parent-component');
const app = document.getElementsByTagName(parentComponentName);
const closeMapBtn = document.createElement('cod-button');
closeMapBtn.addEventListener('click', () => {
app[0].setAttribute('data-app-state', 'results');
(app[0]) ? app[0].setAttribute('data-app-state', 'results') : 0;
});
closeMapBtn.setAttribute('data-primary', true);
closeMapBtn.setAttribute('data-label', 'x');
Expand All @@ -139,7 +143,7 @@ export default class Map extends HTMLElement {
closeMapBtn.setAttribute('data-icon', '');
closeMapBtn.setAttribute('data-shape', 'square');
this.mapWrapper.appendChild(closeMapBtn);
app[0].setAttribute('data-map-state', 'init');
(app[0]) ? app[0].setAttribute('data-map-state', 'init') : 0;
break;
}

Expand Down
6 changes: 3 additions & 3 deletions src/stories/map.stories.js

Large diffs are not rendered by default.

0 comments on commit 65b1860

Please sign in to comment.