From 922e9bff73958a048e8aba71488e7d45c4e5e57a Mon Sep 17 00:00:00 2001 From: jeffgallini <52107906+jeffgallini@users.noreply.github.com> Date: Wed, 2 Sep 2026 18:34:00 -0500 Subject: [PATCH] v1.0.0 push, updating unit tests --- dash_globe/tests/test_usage.py | 11 +++++++---- dash_globe/usage.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/dash_globe/tests/test_usage.py b/dash_globe/tests/test_usage.py index c5eaa06..a2f31f4 100644 --- a/dash_globe/tests/test_usage.py +++ b/dash_globe/tests/test_usage.py @@ -40,7 +40,7 @@ def test_gallery_footer_uses_html_instead_of_markdown(): footer = usage.build_gallery_footer() assert footer.id == "gallery-footer" - assert footer.__class__.__name__ == "P" + assert footer.__class__.__name__ == "Alert" assert not any(component.__class__.__name__ == "Markdown" for component in _walk_components(usage.app.layout)) @@ -459,7 +459,10 @@ def test_render_component_gallery(dash_duo): assert dash_duo.find_element("#choropleth-countries-globe canvas") choropleth_event = "#choropleth-countries-event" - placeholder_text = "Click Run to mount this globe, then hover a country to inspect the latest hover payload." + choropleth_idle_texts = { + usage.CHOROPLETH_COUNTRIES_EVENT_PLACEHOLDER, + usage.CHOROPLETH_COUNTRIES_HOVER_IDLE_TEXT, + } canvas = dash_duo.find_element("#choropleth-countries-globe canvas") dash_duo.driver.execute_script("arguments[0].scrollIntoView({block: 'center'});", canvas) canvas_rect = canvas.rect @@ -481,11 +484,11 @@ def test_render_component_gallery(dash_duo): ActionChains(dash_duo.driver).move_to_element_with_offset(canvas, x_offset, y_offset).perform() time.sleep(0.35) hovered_payload = dash_duo.find_element(choropleth_event).text - if hovered_payload != placeholder_text and '"layer": "polygon"' in hovered_payload: + if '"layer": "polygon"' in hovered_payload: break assert hovered_payload is not None - assert hovered_payload != placeholder_text + assert hovered_payload not in choropleth_idle_texts assert '"layer": "polygon"' in hovered_payload time.sleep(0.9) diff --git a/dash_globe/usage.py b/dash_globe/usage.py index bbc8e79..6cc2513 100644 --- a/dash_globe/usage.py +++ b/dash_globe/usage.py @@ -1112,6 +1112,12 @@ def build_situation_room_selection_signature(snapshots): "https://raw.githubusercontent.com/vasturiano/react-globe.gl/master/example/datasets/" "ne_110m_admin_0_countries.geojson" ) +CHOROPLETH_COUNTRIES_EVENT_PLACEHOLDER = ( + "Click Run to mount this globe, then hover a country to inspect the latest payload." +) +CHOROPLETH_COUNTRIES_HOVER_IDLE_TEXT = ( + "Hover a country to highlight it and inspect the latest hover payload." +) CHOROPLETH_BACKGROUND_IMAGE_URL = "https://unpkg.com/three-globe@2.45.2/example/img/night-sky.png" CHOROPLETH_PALETTE = ["#ffffcc", "#ffeda0", "#fed976", "#feb24c", "#fd8d3c", "#f03b20", "#bd0026"] AIRLINE_ROUTE_COUNTRY = "Portugal" @@ -3979,7 +3985,7 @@ def build_examples_grid(): example_code_and_events( CHOROPLETH_COUNTRIES_EXAMPLE_CODE, event_id="choropleth-countries-event", - event_placeholder="Click Run to mount this globe, then hover a country to inspect the latest payload.", + event_placeholder=CHOROPLETH_COUNTRIES_EVENT_PLACEHOLDER, ), ), globe_card( @@ -4264,7 +4270,7 @@ def highlight_airline_routes(hover_data): Input("choropleth-countries-globe", "hoverData"), ) def highlight_choropleth_country(hover_data): - payload_text = "Hover a country to highlight it and inspect the latest hover payload." + payload_text = CHOROPLETH_COUNTRIES_HOVER_IDLE_TEXT if hover_data is not None: payload_text = json.dumps(hover_data, indent=2)