Beispiel #1
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 #2
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 #3
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 #4
0
def test_page():
    r = t.html(
        t.body(
            t.h1('Title'),
            t.p('Paragraph'),
        )
    ).build()
    print(r)
    assert r == '''<!DOCTYPE html>
Beispiel #5
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 #6
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 #7
0
def test_class_arg():
    r = t.p('Hello', class_='important')
    assert r
Beispiel #8
0
def test_unknown_component():
    r = t.p(object())
    assert r
    soup = r.soup()
    assert soup
Beispiel #9
0
def test_html():
    r = t.p('Hello')
    assert r
    r2 = t.p('Hello')
    assert r2
Beispiel #10
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 #11
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'),
    ),
)