
* [WiP] Support UI components returned from a computed var * Get rid of nasty react hooks warning * include @babel/standalone in the base to avoid CDN * put window variables behind an object * use jsx * implement the thing * cleanup dead test code (#3909) * override dict in propsbase to use camelCase (#3910) * override dict in propsbase to use camelCase * fix underscore in dict * dang it darglint * [REF-3562][REF-3563] Replace chakra usage (#3872) * [ENG-3717] [flexgen] Initialize app from refactored code (#3918) * Remove Pydantic from some classes (#3907) * half of the way there * add dataclass support * Forbid Computed var shadowing (#3843) * get it right pyright * fix unit tests * rip out more pydantic * fix weird issues with merge_imports * add missing docstring * make special props a list instead of a set * fix moment pyi * actually ignore the runtime error * it's ruff out there --------- Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> * Merging * fixss * fix field_name * always import react * move func to file * do some weird things * it's really ruff out there * add docs * how does this work * dang it darglint * fix the silly * don't remove computed guy * silly goose, don't ignore var types :D * update code * put f string on one line * make it deprecated instead of outright killing it * i hate it * add imports from react * assert it has evalReactComponent * do things ig * move get field to global context * ooops --------- Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com> Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com> Co-authored-by: Elijah Ahianyo <elijahahianyo@gmail.com>
33 lines
907 B
Python
33 lines
907 B
Python
import pytest
|
|
|
|
from reflex.components.datadisplay.code import CodeBlock, Theme
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"theme, expected",
|
|
[(Theme.one_light, "oneLight"), (Theme.one_dark, "oneDark")],
|
|
)
|
|
def test_code_light_dark_theme(theme, expected):
|
|
code_block = CodeBlock.create(theme=theme)
|
|
|
|
assert code_block.theme._js_expr == expected # type: ignore
|
|
|
|
|
|
def generate_custom_code(language, expected_case):
|
|
return f"SyntaxHighlighter.registerLanguage('{language}', {expected_case})"
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"language, expected_case",
|
|
[
|
|
("python", "python"),
|
|
("firestore-security-rules", "firestoreSecurityRules"),
|
|
("typescript", "typescript"),
|
|
],
|
|
)
|
|
def test_get_custom_code(language, expected_case):
|
|
code_block = CodeBlock.create(language=language)
|
|
assert code_block._get_custom_code() == generate_custom_code(
|
|
language, expected_case
|
|
)
|