File: test_template.py

package info (click to toggle)
python-trame-client 3.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 3,128 kB
  • sloc: python: 9,583; javascript: 3,897; sh: 9; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from trame.app import get_server
from trame_client.widgets.html import Div

CLIENT_TYPE = "vue3"


def test_properties():
    server = get_server("test_properties", client_type=CLIENT_TYPE)
    widget = Div(
        trame_server=server,
        v_model_hello="world",
        v_model_hello_world="something",
        v_bind_hello="world",
        v_bind_hello_world="something",
        v_model_number="number_value",
    )
    assert widget.html == (
        "<div "
        'v-model:hello="world" '
        'v-model:hello.world="something" '
        ':hello="world" '
        ':hello.world="something" '
        'v-model.number="number_value" '
        "/>"
    )


def test_events():
    server = get_server("test_events", client_type=CLIENT_TYPE)
    widget = Div(
        trame_server=server,
        v_on_click="click",
        v_on_mouseenter_left="left",
        v_on_mouseout_left_stop="left_stop",
    )
    assert widget.html == (
        '<div @click="click" @mouseenter.left="left" @mouseout.left.stop="left_stop" />'
    )