Exemplo n.º 1
0
def test_js_script_embed():
    from makeweb import JS, Doc, script
    js = JS()

    @js.script
    def test():
        alert('wut?')

    doc = Doc()
    with script():
        js.embed()
    assert str(doc) == '<script>alert("wut?");</script>'
Exemplo n.º 2
0
def test_js_function_embed():
    from makeweb import JS, Doc, script
    js = JS()

    @js.function
    def test():
        alert('wut?')

    doc = Doc()
    with script():
        js.embed()
    assert str(doc) == '<script>function test(){alert("wut?");}</script>'
Exemplo n.º 3
0
def test_js_script():
    from makeweb import JS
    js = JS()

    @js.script
    def test():
        alert('wut?')

    assert str(js) == 'alert("wut?");'
Exemplo n.º 4
0
def test_js_function():
    from makeweb import JS
    js = JS()

    @js.function
    def test():
        alert('wut?')

    assert str(js) == 'function test(){alert("wut?");}'
Exemplo n.º 5
0
    JS,
    head,
    title,
    style,
    script,
    body,
    div,
    a,
    span,
    i,
)

# Initialize app, css and js.
app = Flask(__name__)
css = CSS()
js = JS()

# Let us define some style for our page and clock.
#
# If you know css, this should look familiar.
# Note that we use double-underscore where a hyphen is expected,
# since python does not allow hyphens in identifiers.
#
# Internals: MakeWeb's css support works with python's __call__() feature.

css(
    'body',
    background__color='#102719',
    color='#93ff45',
    font__family='roboto-mono,monospace',
    text__align='center',