Beispiel #1
0
def mobile():
    return (
        t.meta(name="viewport",
               content="width=device-width, user-scalable=no"),
        t.meta(name='apple-mobile-web-app-capable', content="yes"),
        t.meta(name="mobile-web-app-capable", content="yes"),
    )
Beispiel #2
0
def test_inject_js_footer():
    page = t.html(t.body(
        inject_js_footer('https://example.com/script.js'), ), )
    assert page
    result = page.build()
    assert result
    assert 'https://example.com/script.js' in result
Beispiel #3
0
def truc(title):
    global lib
    return t.div(
        t.h2(title),
        t.p('Bla bla bla', class_='btn btn-info'),
        lib.css('bootstrap'),
    )
Beispiel #4
0
def test_script():
    r = t.section(
        t.h2('Subtitle'),
        t.script('alert("hello");'),
        )
    assert r
    print(r.build())
    assert r.build() == """<section>
Beispiel #5
0
def mobile():
    return (t.meta(name="viewport",
                   content="width=device-width, user-scalable=no"),
            t.meta(name='apple-mobile-web-app-capable',
                   content="yes"),
            t.meta(name="mobile-web-app-capable",
                   content="yes"),
            )
Beispiel #6
0
def truc(title):
    global lib
    return t.div(
        t.h2(title),
        t.p('Bla bla bla', class_='btn btn-info'),


        lib.css('bootstrap'),
    )
Beispiel #7
0
def test_page():
    r = t.html(
        t.body(
            t.h1('Title'),
            t.p('Paragraph'),
        )
    ).build()
    print(r)
    assert r == '''<!DOCTYPE html>
Beispiel #8
0
def friends():
    return t.html(
        t.head(
            f.utf8(),
            f.viewport(),
            f.IEedge(),

            lib.css('/static/style.css'),

            lib.js('jquery'),

            lib.js('/static/react-0.10.0/react.js'),
            lib.js('/static/friends/list.js'),
        ),

        t.body(
            t.header(
                t.h1(
                    t.a('Statistics', href='/'),
                    '/',
                    'Friends'
                ),
            ),

            t.section(
                t.div(
                    id='friendslist',
                ),
            ),
        ),
    ).build()
Beispiel #9
0
def test_sum():
    p1 = t.p('First Paragraph.')
    p2 = t.p('Second Paragraph.')
    assert p1
    assert p2

    group1 = (p1, p2)
    assert group1

    p3 = t.p('Third Paragraph.')
    group2 = (group1, p3)

    section = t.section(group2)
    assert section
    assert section.build() == '''<section>
Beispiel #10
0
def test_js_insert():
    p = t.html(
        lib.js('d3'),
    )
    assert p
    result = p.build()
    assert result == '''<!DOCTYPE html>
Beispiel #11
0
def test_js_duplicates():
    page = t.html(
        lib.js('d3'),
        lib.js('d3'),
    )
    result = page.build()
    assert result.count('http://d3js.org/d3.v3.min.js') == 1
Beispiel #12
0
def test_css_insert():
    p = t.html(lib.css('bootstrap'), )
    assert p
    result = p.build()
    print(result)
    assert result
    assert result == '''<!DOCTYPE html>
Beispiel #13
0
def test_js_duplicates():
    page = t.html(
        lib.js('d3'),
        lib.js('d3'),
    )
    result = page.build()
    assert result.count('http://d3js.org/d3.v3.min.js') == 1
Beispiel #14
0
def test_css_insert():
    p = t.html(
        lib.css('bootstrap'),
    )
    assert p
    result = p.build()
    print(result)
    assert result
    assert result == '''<!DOCTYPE html>
Beispiel #15
0
def test_page():
    page = t.html(
        t.head(
            t.title('Title'),
            t.meta(charset='utf-8'),
            f.css('style.css'),
        ),
        t.body(
            t.h1('Page Title'),
            t.p(
                t.i('Hello'),
            ),
            t.p('Come back later for more !'),
        ),
    )
    assert page
    assert page.build() == '''<!DOCTYPE html>
Beispiel #16
0
def test_inject_css():
    page = t.html(
        t.head(t.meta(charset="utf-8"), ),
        t.body(
            t.h1("A page"),
            t.p("Yup, this is a page on the World Wild Web."),
            inject_css('https://example.com/style.css'),
        ),
    )
    assert page
    result = page.build()
    assert result
    print(result)
    assert '<link href="https://example.com/style.css" ' \
           'rel="stylesheet" type="text/css"/>' in result
Beispiel #17
0
def utf8():
    return t.meta(charset='utf-8')
Beispiel #18
0
from tumulus.tags import HTMLTags as t
from tumulus.plugins import inject_css, inject_js_footer, inject_js_head
import tumulus.lib as lib


def truc(title):
    global lib
    return t.div(
        t.h2(title),
        t.p('Bla bla bla', class_='btn btn-info'),
        lib.css('bootstrap'),
    )


page = t.html(
    t.head(t.meta(charset="utf-8"), ),
    t.body(
        t.h1("A page"),
        t.p("Yup, this is a page on the World Wild Web."),
        # inject_css('http://okso.me/static/style.css'),
        truc('Salut les amis'),

        # lib.js('d3'),
        # lib.js('jquery'),
        # lib.js('http://d3js.org/d3.v3.min.js'),
        # lib.js('bootstrap'),
        # lib.css('bootstrap'),
    ),
)
Beispiel #19
0
def IEedge():
    return t.meta(content="IE=edge", **{"http-equiv": "X-UA-Compatible"})
Beispiel #20
0
def test_unknown_component():
    r = t.p(object())
    assert r
    soup = r.soup()
    assert soup
Beispiel #21
0
def test_class_arg():
    r = t.p('Hello', class_='important')
    assert r
Beispiel #22
0
def test_inject_css_nohead():
    page = t.html(t.body(inject_css('https://example.com/style.css'), ), )
    assert page
    result = page.build()
    assert result
Beispiel #23
0
def test_html():
    r = t.p('Hello')
    assert r
    r2 = t.p('Hello')
    assert r2
Beispiel #24
0
def test_js_insert():
    p = t.html(lib.js('d3'), )
    assert p
    result = p.build()
    assert result == '''<!DOCTYPE html>
Beispiel #25
0
def viewport():
    return t.meta(name="viewport",
                  content="width=device-width, initial-scale=1")
Beispiel #26
0
def index():
    return t.html(
        t.head(
            f.utf8(),
            f.viewport(),
            f.IEedge(),

            #lib.css('/static/bootstrap-3.2.0/css/bootstrap.min.css'),
            #lib.css('/static/bootstrap-3.2.0/css/bootstrap-theme.min.css'),

            lib.css('/static/style.css'),


            lib.js('d3'),
            lib.js('dimple'),
            #lib.js('/static/bootstrap-3.2.0/js/bootstrap.min.js'),

            lib.js('/stats/sent_vs_recv.js'),
            lib.js('/stats/sent_and_recv_over_time.js'),
            lib.js('/stats/obfuscated_profile.js'),
            lib.js('/stats/obfuscated_profile_outgoing.js'),
            lib.js('/stats/real_profile.js'),
            lib.js('/stats/real_profile_outgoing.js'),
        ),
        t.body(
            t.header(
                t.h1(
                    'Statistics',
                    '/',
                    t.a('Friends', href='/friends'),
                ),
            ),

            t.section(
                t.h2('Total traffic'),
                t.div(id='sent_vs_recv'),

                t.h2('Messages per minute'),
                t.div(id='sent_and_recv_over_time'),

                t.h2('Obfuscated outgoing profile'),
                t.div(id='obfuscated_profile_outgoing'),

                t.h2('Real outgoing profile'),
                t.div(id='real_profile_outgoing'),

                t.h2('Obfuscated profile'),
                t.div(id='obfuscated_profile'),

                t.h2('Real profile'),
                t.div(id='real_profile'),

                class_='container',
            ),
        ),
    ).build()
Beispiel #27
0
def utf8():
    return t.meta(charset='utf-8')
Beispiel #28
0
def IEedge():
    return t.meta(content="IE=edge", **{"http-equiv": "X-UA-Compatible"})
Beispiel #29
0
def vimeo(video_id):
    return t.iframe(
        src="https://player.vimeo.com/video/{}".format(video_id),
        width="640", height="360", frameborder="0",
        webkitallowfullscreen='', mozallowfullscreen='', allowfullscreen='')
Beispiel #30
0
def viewport():
    return t.meta(name="viewport",
                  content="width=device-width, initial-scale=1")
Beispiel #31
0
def test_mobile():
    r = f.mobile()
    assert r
    head = t.head(r)
    assert head.build() == '''<head>
Beispiel #32
0
def css(href):
    return t.link(rel='stylesheet', type='text/css', href=href)
Beispiel #33
0
from tumulus.tags import HTMLTags as t

page = t.html(
    t.body(
        'Hello',
    ),
)
Beispiel #34
0

def truc(title):
    global lib
    return t.div(
        t.h2(title),
        t.p('Bla bla bla', class_='btn btn-info'),


        lib.css('bootstrap'),
    )

page = t.html(
    t.head(
        t.meta(charset="utf-8"),
    ),
    t.body(
        t.h1("A page"),
        t.p("Yup, this is a page on the World Wild Web."),
        # inject_css('http://okso.me/static/style.css'),

        truc('Salut les amis'),

        # lib.js('d3'),
        # lib.js('jquery'),
        # lib.js('http://d3js.org/d3.v3.min.js'),
        # lib.js('bootstrap'),
        # lib.css('bootstrap'),
    ),
)
Beispiel #35
0
def youtube(video_id):
    return t.iframe(
        id='ytplayer', type='text/html', width='640', height='360',
        src='https://www.youtube.com/embed/{}'.format(video_id),
        frameborder="0", allowfullscreen='')
Beispiel #36
0
def css(href):
    return t.link(rel='stylesheet', type='text/css', href=href)