diff --git a/server/webdriver/shared_tests/map_test.py b/server/webdriver/shared_tests/map_test.py index 2823e5d2a0..30a41a71f8 100644 --- a/server/webdriver/shared_tests/map_test.py +++ b/server/webdriver/shared_tests/map_test.py @@ -80,46 +80,14 @@ def test_charts_from_url(self): by=By.CSS_SELECTOR, value='#choropleth-legend .tick')), 5) - # Click United States breadcrumb - shared.click_el(self.driver, (By.LINK_TEXT, 'United States')) - - # Assert redirect was correct - shared.wait_for_loading(self.driver) - self.assertEqual( - find_elem(self.driver, - by=By.CSS_SELECTOR, - value='#place-list > div > span').text, - 'United States of America') - - # Select State place type - shared.wait_for_loading(self.driver) - place_type_selector = find_elem(self.driver, - by=By.ID, - value='place-selector-place-type') - place_type_selector.click() - find_elem(place_type_selector, by=By.XPATH, value='./option[2]').click() - - # Assert that a map chart is loaded - self.assertIsNotNone(wait_elem(self.driver, by=By.ID, value='map-items')) - self.assertIn( - "median age of population ", - find_elem(self.driver, - by=By.XPATH, - value='//*[@id="map-chart"]/div/div[1]/h3').text.lower()) - self.assertEqual( - len(find_elems(self.driver, by=By.CSS_SELECTOR, - value='#map-items path')), 52) - # Click explore timeline find_elem(self.driver, value='explore-timeline-text').click() # Assert rankings page loaded - new_page_title = ( - 'Ranking by Median Age - States in United States of America - Place ' + - 'Rankings - ' + self.dc_title_string) - WebDriverWait(self.driver, - self.TIMEOUT_SEC).until(EC.title_contains(new_page_title)) - self.assertEqual(new_page_title, self.driver.title) + expected_ranking_page_title = 'Ranking by Median Age - Counties in California - Place Rankings - ' + self.dc_title_string + WebDriverWait(self.driver, self.TIMEOUT_SEC).until( + EC.title_contains(expected_ranking_page_title)) + self.assertEqual(expected_ranking_page_title, self.driver.title) @pytest.mark.one_at_a_time def test_manually_enter_options(self): diff --git a/static/js/tools/map/place_details.tsx b/static/js/tools/map/place_details.tsx index 7d1bce6e22..12d44bbd69 100644 --- a/static/js/tools/map/place_details.tsx +++ b/static/js/tools/map/place_details.tsx @@ -33,11 +33,7 @@ import { } from "../../shared/types"; import { MAP_CONTAINER_ID } from "./chart"; import { Context, DisplayOptions, PlaceInfo, StatVar } from "./context"; -import { - getAllChildPlaceTypes, - getParentPlaces, - getRedirectLink, -} from "./util"; +import { getParentPlaces } from "./util"; interface PlaceDetailsPropType { breadcrumbDataValues: { [dcid: string]: number }; @@ -133,8 +129,8 @@ export function PlaceDetails(props: PlaceDetailsPropType): JSX.Element { ); } -function highlightPlace(e: React.MouseEvent): void { - const target = e.target as HTMLAnchorElement; +function highlightPlace(e: React.MouseEvent): void { + const target = e.target as HTMLElement; const placeDcid = target.dataset.geodcid; highlightPlaceToggle( document.getElementById(MAP_CONTAINER_ID), @@ -143,8 +139,8 @@ function highlightPlace(e: React.MouseEvent): void { ); } -function unhighlightPlace(e: React.MouseEvent): void { - const target = e.target as HTMLAnchorElement; +function unhighlightPlace(e: React.MouseEvent): void { + const target = e.target as HTMLElement; const placeDcid = target.dataset.geodcid; highlightPlaceToggle( document.getElementById(MAP_CONTAINER_ID), @@ -183,31 +179,17 @@ function getListItemElement( enclosingPlace, placeInfo.parentPlaces ); - const redirectLink = getRedirectLink( - statVar, - place, - parentPlaces, - placeInfo.mapPointPlaceType, - display - ); - const shouldBeClickable = !_.isEmpty( - getAllChildPlaceTypes(place, parentPlaces) - ); + return (
{itemNumber && `${itemNumber}. `} - {shouldBeClickable ? ( - - {place.name} - - ) : ( - `${place.name}` - )} + + {place.name} + {date}: {value}
);