diff --git a/assets/style.css b/assets/style.css index 2b20604ae93435dd30a516375cc4c54a1223fc96..75570f94bb8ff19896a3251d41316b7527d8d040 100644 --- a/assets/style.css +++ b/assets/style.css @@ -732,6 +732,9 @@ div.SingleDatePickerInput { font-size: 10px !important; } +.leaflet-control-zoom-fullscreen { + display: none !important; +} /* .graph-with-slider { height: 93vh !important; diff --git a/tabs/forecast_callbacks.py b/tabs/forecast_callbacks.py index c29dd84b2946c8f4e070d9ce946c5d56b185f791..9ae77f7bfcfb6f3e4461422ec3fe9abb855ae2e8 100644 --- a/tabs/forecast_callbacks.py +++ b/tabs/forecast_callbacks.py @@ -939,6 +939,7 @@ def show_timeseries(ts_button, mod, date, variable, coords, popups): State('country-lon', 'value'), State({'tag': 'model-map', 'index': ALL, "n_clicks": ALL}, 'id'), ], + prevent_initial_call=True ) def zoom_country(n_clicks, tstep, date, model, variable, static, view, zoom, lat, lon, ids): """Set zoom and center over coordinates entered""" diff --git a/tests/test_observations_callbacks.py b/tests/test_observations_callbacks.py new file mode 100644 index 0000000000000000000000000000000000000000..a91b16502a2ac1b9bd79ffb4f19627026c63aa81 --- /dev/null +++ b/tests/test_observations_callbacks.py @@ -0,0 +1,34 @@ +import pytest +import importlib +import dash +from contextvars import copy_context +from dash._callback_context import context_value +from dash._utils import AttributeDict +code = importlib.import_module('tabs.observations_callbacks') + + +#============ TEST render_evaluation_tab================================= +def test_render_observations_tab(): + # CASE 1, RGB 1 CLICK, VISIBILITY NO CLICK + def run_callback(): + context_value.set(AttributeDict(**{"triggered_inputs": [{"prop_id": "rgb.n_clicks"},{"prop_id": "visibility.n_clicks"}]})) + return code.render_observations_tab(1, 0) + + ctx = copy_context() + output = ctx.run(run_callback) + assert "All observations are kindly offered by Partners of the WMO Barcelona Dust Regional Center. RGB is a qualitative satellite product that indicates desert dust in the entire atmospheric column (represented by pink colour).']), className='description-body'), Div(children=[Button(children='HEMISPHERIC', id='btn-fulldisc', active=True), Button(children='MIDDLE EAST', id='btn-middleeast', active=False)], id='rgb-buttons'), Div(children=[Img(id='rgb-image', alt='EUMETSAT RGB - NOT AVAILABLE', src='./assets/eumetsat/FullDiscHD/archive/20220831/FRAME_OIS_RGB-dust-all_202208310000.gif'), Div(children=Div(children=[Span(children=DatePickerSingle(date='20220831', min_date_allowed=datetime.datetime(2012, 1, 20, 0, 0), max_date_allowed=datetime.datetime(2022, 8, 31, 0, 0), placeholder='DD MON YYYY', initial_visible_month=datetime.datetime(2022, 8, 31, 0, 0), clearable=True, reopen_calendar_on_clear=True, display_format='DD MMM YYYY', id='obs-date-picker'), className='timesliderline'), Span(children=[Button(id='btn-obs-play', className='fa fa-play', n_clicks=0, title='Play'), Button(id='btn-obs-stop', className='fa fa-pause', n_clicks=0, title='Stop')], className='timesliderline anim-buttons'), Span(children=Slider(min=0, max=23, step=1, marks={0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12', 13: '13', 14: '14', 15: '15', 16: '16', 17: '17', 18: '18', 19: '19', 20: '20', 21: '21', 22: '22', 23: '23'}, value=0, id='obs-slider-graph'), className='timesliderline')], className='timeslider'), className='layout-dropdown')], className='centered-image'), Div(Interval(id='obs-slider-interval', disabled=True, interval=1000, n_intervals=0))], id='observations-tab', className='horizontal-menu', label='Observations', value='observations-tab')" in str(output[0]) + assert output[1:] == ({ 'font-weight': 'bold' }, { 'font-weight': 'normal' }, 'rgb') + + +def test_render_observations_tab_visibility(): + # CASE 2, RGB NO CLICK, VISIBILITY 1 CLICK + def run_callback(): + context_value.set(AttributeDict(**{"triggered_inputs": [{"prop_id": "rgb.n_clicks"},{"prop_id": "visibility.n_clicks"}]})) + return code.render_observations_tab(1, 1) + + ctx = copy_context() + output = ctx.run(run_callback) + assert "All observations are kindly offered by Partners of the WMO Barcelona Dust Regional Center. RGB is a qualitative satellite product that indicates desert dust in the entire atmospheric column (represented by pink colour).']), className='description-body'), Div(children=[Button(children='HEMISPHERIC', id='btn-fulldisc', active=True), Button(children='MIDDLE EAST', id='btn-middleeast', active=False)], id='rgb-buttons'), Div(children=[Img(id='rgb-image', alt='EUMETSAT RGB - NOT AVAILABLE', src='./assets/eumetsat/FullDiscHD/archive/20220831/FRAME_OIS_RGB-dust-all_202208310000.gif'), Div(children=Div(children=[Span(children=DatePickerSingle(date='20220831', min_date_allowed=datetime.datetime(2012, 1, 20, 0, 0), max_date_allowed=datetime.datetime(2022, 8, 31, 0, 0), placeholder='DD MON YYYY', initial_visible_month=datetime.datetime(2022, 8, 31, 0, 0), clearable=True, reopen_calendar_on_clear=True, display_format='DD MMM YYYY', id='obs-date-picker'), className='timesliderline'), Span(children=[Button(id='btn-obs-play', className='fa fa-play', n_clicks=0, title='Play'), Button(id='btn-obs-stop', className='fa fa-pause', n_clicks=0, title='Stop')], className='timesliderline anim-buttons'), Span(children=Slider(min=0, max=23, step=1, marks={0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12', 13: '13', 14: '14', 15: '15', 16: '16', 17: '17', 18: '18', 19: '19', 20: '20', 21: '21', 22: '22', 23: '23'}, value=0, id='obs-slider-graph'), className='timesliderline')], className='timeslider'), className='layout-dropdown')], className='centered-image'), Div(Interval(id='obs-slider-interval', disabled=True, interval=1000, n_intervals=0))], id='observations-tab', className='horizontal-menu', label='Observations', value='observations-tab')" in str(output[0]) + assert output[1:] == ({ 'font-weight': 'bold' }, { 'font-weight': 'normal' }, 'rgb') + +