test_link.py 507 B

123456789101112131415
  1. from reflex.components.base.link import RawLink, ScriptTag
  2. def test_raw_link():
  3. raw_link = RawLink.create("https://example.com").render()
  4. assert raw_link["name"] == "link"
  5. assert raw_link["children"][0]["contents"] == '{"https://example.com"}'
  6. def test_script_tag():
  7. script_tag = ScriptTag.create("console.log('Hello, world!');").render()
  8. assert script_tag["name"] == "script"
  9. assert (
  10. script_tag["children"][0]["contents"] == "{\"console.log('Hello, world!');\"}"
  11. )