def __init__(self, view, x, y, alt=None, text=None, theme=None): super().__init__(view, alt=alt) image_url = Url('holder.js/%sx%s' % (x, y)) options = theme or Theme() image_url.set_query_from(options) if text is not None: # Our query string will url-escape text. Text often has spaces # that would now become +. Holder does not do the reverse, so # we have to add the text as an un-escaped query string argument image_url = '%s%stext=%s' % (str(image_url), '?' if not options else '&', text) self.set_attribute('data-src', str(image_url))
def default_active_multi_tab(fixture): """The first item of the first tab is active by default (if the active tab is not indicated in the query_string).""" fixture.reahl_server.set_app(fixture.wsgi_app) url = Url('/') url.set_query_from(fixture.query_args) fixture.driver_browser.open(str(url)) vassert(fixture.tab_contents_equals(fixture.expected_contents)) vassert((not fixture.multi_tab_active) or fixture.tab_is_active('multitab name')) vassert((not fixture.tab1_active) or fixture.tab_is_active('tab 1 name')) vassert((not fixture.tab2_active) or fixture.tab_is_active('tab 2 name')) vassert((not fixture.tab3_active) or fixture.tab_is_active('tab 3 name'))
def test_default_active_multi_tab(web_fixture, tabbed_panel_ajax_fixture, default_multi_tab_scenarios): """The first item of the first tab is active by default (if the active tab is not indicated in the query_string).""" fixture = default_multi_tab_scenarios web_fixture.reahl_server.set_app(tabbed_panel_ajax_fixture.wsgi_app) url = Url('/') url.set_query_from(fixture.query_args) web_fixture.driver_browser.open(str(url)) assert tabbed_panel_ajax_fixture.tab_contents_equals(fixture.expected_contents) assert (not fixture.multi_tab_active) or tabbed_panel_ajax_fixture.tab_is_active('multitab name') assert (not fixture.tab1_active) or tabbed_panel_ajax_fixture.tab_is_active('tab 1 name') assert (not fixture.tab2_active) or tabbed_panel_ajax_fixture.tab_is_active('tab 2 name') assert (not fixture.tab3_active) or tabbed_panel_ajax_fixture.tab_is_active('tab 3 name')