Beispiel #1
0
def actions_block() -> ActionsBlock:
    return ActionsBlock(
        elements=[
            RadioButtonGroupElement(
                action_id="action-block",
                options=[
                    OptionObject(
                        PlainTextObject(text="Action block 1"), value="action1"
                    ),
                    OptionObject(
                        PlainTextObject(text="Action block 2"), value="action2"
                    ),
                ],
            ),
            PlainTextInputElement(
                action_id="input1",
                placeholder=PlainTextObject(text="Input"),
                initial_value="Input",
            ),
            OverflowElement(
                action_id="overflow1",
                options=[
                    OptionObject(
                        PlainTextObject(text="Overflow block 1"), value="overflow1"
                    ),
                    OptionObject(
                        PlainTextObject(text="Overflow block 2"), value="overflow2"
                    ),
                ],
            ),
        ]
    )
Beispiel #2
0
def context_block() -> ContextBlock:
    return ContextBlock(elements=[
        PlainTextInputElement(action_id="plaintext1",
                              placeholder=PlainTextObject(text="Context")),
        RadioButtonGroupElement(
            action_id="radiobutton1",
            options=[
                OptionObject(PlainTextObject(text="Radio button 1"),
                             value="radio1"),
                OptionObject(PlainTextObject(text="Radio button 2"),
                             value="radio2"),
            ],
        ),
    ])
Beispiel #3
0
def option_object() -> OptionObject:
    option = str(random.randint(0, 10))
    return OptionObject(
        text=PlainTextObject(text="Option {}".format(option)),
        value=option,
        url="https://codedevils.org/{}".format(option),
    )
Beispiel #4
0
def test_option_object(option_object: OptionObject):
    assert option_object.render() == {
        "text": option_object.text.render(),
        "value": option_object.value,
        "url": option_object.url,
    }
Beispiel #5
0
def _get_options_list() -> typing.List[OptionObject]:
    return [
        OptionObject(text=PlainTextObject(text="Option"), value="Option")
        for _ in range(0, random.randint(3, 5))
    ]