Skip to content

Commit 217a373

Browse files
committed
fix tests
1 parent f33e6f2 commit 217a373

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

tests/units/compiler/test_compiler.py

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from reflex import constants
99
from reflex.compiler import compiler, utils
1010
from reflex.components.base import document
11+
from reflex.components.el.elements.metadata import Link
1112
from reflex.constants.compiler import PageNames
1213
from reflex.utils.imports import ImportVar, ParsedImportDict
1314
from reflex.vars.base import Var
@@ -364,7 +365,7 @@ def test_create_document_root():
364365
assert isinstance(lang, LiteralStringVar)
365366
assert lang.equals(Var.create("en"))
366367
# No children in head.
367-
assert len(root.children[0].children) == 5
368+
assert len(root.children[0].children) == 6
368369
assert isinstance(root.children[0].children[1], utils.Meta)
369370
char_set = root.children[0].children[1].char_set # pyright: ignore [reportAttributeAccessIssue]
370371
assert isinstance(char_set, LiteralStringVar)
@@ -374,7 +375,8 @@ def test_create_document_root():
374375
assert isinstance(name, LiteralStringVar)
375376
assert name.equals(Var.create("viewport"))
376377
assert isinstance(root.children[0].children[3], document.Meta)
377-
assert isinstance(root.children[0].children[4], document.Links)
378+
assert isinstance(root.children[0].children[4], Link)
379+
assert isinstance(root.children[0].children[5], document.Links)
378380

379381

380382
def test_create_document_root_with_scripts():
@@ -389,9 +391,18 @@ def test_create_document_root_with_scripts():
389391
html_custom_attrs={"project": "reflex"},
390392
)
391393
assert isinstance(root, utils.Html)
392-
assert len(root.children[0].children) == 7
394+
assert len(root.children[0].children) == 8
393395
names = [c.tag for c in root.children[0].children]
394-
assert names == ["script", "Scripts", "Scripts", "meta", "meta", "Meta", "Links"]
396+
assert names == [
397+
"script",
398+
"Scripts",
399+
"Scripts",
400+
"meta",
401+
"meta",
402+
"Meta",
403+
"link",
404+
"Links",
405+
]
395406
lang = root.lang # pyright: ignore [reportAttributeAccessIssue]
396407
assert isinstance(lang, LiteralStringVar)
397408
assert lang.equals(Var.create("rx"))
@@ -408,9 +419,9 @@ def test_create_document_root_with_meta_char_set():
408419
head_components=comps,
409420
)
410421
assert isinstance(root, utils.Html)
411-
assert len(root.children[0].children) == 5
422+
assert len(root.children[0].children) == 6
412423
names = [c.tag for c in root.children[0].children]
413-
assert names == ["script", "meta", "meta", "Meta", "Links"]
424+
assert names == ["script", "meta", "meta", "Meta", "link", "Links"]
414425
assert str(root.children[0].children[1].char_set) == '"cp1252"' # pyright: ignore [reportAttributeAccessIssue]
415426

416427

@@ -424,9 +435,9 @@ def test_create_document_root_with_meta_viewport():
424435
head_components=comps,
425436
)
426437
assert isinstance(root, utils.Html)
427-
assert len(root.children[0].children) == 6
438+
assert len(root.children[0].children) == 7
428439
names = [c.tag for c in root.children[0].children]
429-
assert names == ["script", "meta", "meta", "meta", "Meta", "Links"]
440+
assert names == ["script", "meta", "meta", "meta", "Meta", "link", "Links"]
430441
assert str(root.children[0].children[1].http_equiv) == '"refresh"' # pyright: ignore [reportAttributeAccessIssue]
431442
assert str(root.children[0].children[2].name) == '"viewport"' # pyright: ignore [reportAttributeAccessIssue]
432443
assert str(root.children[0].children[2].content) == '"foo"' # pyright: ignore [reportAttributeAccessIssue]

0 commit comments

Comments
 (0)