Skip to content

Add integration tests for rx.code_block #6484

@masenf

Description

@masenf

Describe the Enhancement you want
Would like playwright integration tests for the rx.code_block -- end to end check of functionality.

  • Which feature do you want to improve? (and what problem does it have)
    We've got quite a few props on the code_block, some of which significantly change its rendered structure and there is currently no validation that these props continue to work.
    theme: Var[Theme] = field(
        default=Theme.one_light,
        doc="The theme to use, accessed via rx.code_block.themes (e.g. rx.code_block.themes.one_dark).",
    )

    language: Var[LiteralCodeLanguage] = field(
        default=Var.create("python"), doc="The language to use."
    )

    code: Var[str] = field(doc="The code to display.")

    show_line_numbers: Var[bool] = field(
        doc="If this is enabled line numbers will be shown next to the code block."
    )

    starting_line_number: Var[int] = field(doc="The starting line number to use.")

    wrap_long_lines: Var[bool] = field(doc="Whether to wrap long lines.")

    custom_style: dict[str, str | Var | Color] = field(
        doc="A custom style for the code block.",
        default_factory=dict,
        is_javascript_property=False,
    )

    code_tag_props: Var[dict[str, str | dict[str, str]]] = field(
        doc="Props passed down to the code tag."
    )

    # Whether a copy button should appear.
    can_copy: bool | None = field(
        default=False,
        is_javascript_property=False,
    )

    # A custom copy button to override the default one.
    copy_button: bool | Component | None = field(
        default=None,
        is_javascript_property=False,
    )
  • What is the benefit of the enhancement?
    Avoid regressions in code_block functionality as the framework changes around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementAnything you want improved

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions