示例#1
0
def test_placeholder_with_text(web_fixture):

    placeholder = PlaceholderImage(web_fixture.view, 20, 30, text='My banner')

    expected_value = 'holder.js/20x30?text=My banner'
    actual_value = placeholder.get_attribute('data-src')
    assert actual_value == expected_value
示例#2
0
def test_text_and_theme_options_are_encoded(web_fixture):

    my_theme = CustomTheme(bg='white', fg='red')
    placeholder = PlaceholderImage(web_fixture.view, 20, 30, text='My sê goed', theme=my_theme)

    expected_value = 'holder.js/20x30?bg=white&fg=red&text=My sê goed'
    actual_value = placeholder.get_attribute('data-src')
    assert actual_value == expected_value
示例#3
0
def test_placeholder_with_predefine_theme(web_fixture):

    my_theme = PredefinedTheme('lava')
    placeholder = PlaceholderImage(web_fixture.view, 20, 30, theme=my_theme)

    expected_value = 'holder.js/20x30?theme=lava'
    actual_value = placeholder.get_attribute('data-src')
    assert actual_value == expected_value
示例#4
0
文件: carousel.py 项目: diopib/reahl
    def __init__(self, view):
        super(MyPage, self).__init__(view)
        self.body.use_layout(Container())

        carousel = Carousel(view, 'my_example_carousel_id', show_indicators=True)
        self.body.add_child(carousel)

        carousel.add_slide(PlaceholderImage(view, 900, 500, text='Slide 1', alt='Slide 1 was here'),
                           caption_widget=P(view, text='a paragraph with text'))

        carousel.add_slide(PlaceholderImage(view, 900, 500, text='Slide 2', alt='Slide 2 was here'),
                           caption_widget=P(view, text='a different paragraph'))
示例#5
0
def test_placeholder_basics(web_fixture):
    """
       hint: Ensure the Holder(Library) is added to the  web.frontend_libraries config setting in the file:web.config.py
    """
    placeholder = PlaceholderImage(web_fixture.view, 20, 30)

    tester = WidgetTester(placeholder)

    expected_html = '<img data-src="holder.js/20x30">'
    actual = tester.render_html()
    assert actual == expected_html