import pytest
import importlib
code = importlib.import_module('generic')

#=============================== START LAYOUT LAYERS ========================
def test_layout_layers_single_input():
    assert  "Div([Span(DropdownMenu(children=[DropdownMenuItem(children='AIRPORTS', id='airports')], id='map-layers-dropdown', direction='up', label='LAYERS'))])" in str(code.layout_layers('airports'))

def test_layout_layers_double_input():
    assert  "Div([Span(DropdownMenu(children=[DropdownMenuItem(children='AIRPORTS', id='airports'), DropdownMenuItem(children='SECOND_LAYER', id='second_layer')], id='map-layers-dropdown', direction='up', label='LAYERS'))])" in str(code.layout_layers('airports', 'second_layer'))

#=============================== START TIME SERIES ========================
def test_time_series():
    assert  "Div(children=[Spinner(children=[Modal(children=[], id='ts-modal', centered=True, is_open=False, size='xl')], id='loading-ts-modal', fullscreen=True, fullscreen_style={'opacity': '0.5', 'zIndex': '200000'}, show_initially=False)], id='open-timeseries')" in str(code.time_series())

#=============================== START LAYOUT VIEW ========================
def test_layout_view():
    assert  "Div(children=[Span(DropdownMenu(children=[DropdownMenuItem(children='Light', id={'tag': 'view-style', 'index': 'carto-positron'}, active=True), DropdownMenuItem(children='Open street map', id={'tag': 'view-style', 'index': 'open-street-map'}, active=False), DropdownMenuItem(children='Terrain', id={'tag': 'view-style', 'index': 'stamen-terrain'}, active=False), DropdownMenuItem(children='ESRI', id={'tag': 'view-style', 'index': 'esri-world'}, active=False)], id='map-view-dropdown', direction='up', in_navbar=True, label='VIEW'))], id='map-view-dropdown-div')" in str(code.layout_view())


