Skip to content

Commit 6394547

Browse files
committed
Add test for React fragment
1 parent 1e174b3 commit 6394547

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

test/ViewEngineTest.fs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,23 @@ let ``Nested content should render correctly`` () =
218218
let html =
219219
nested
220220
|> Render.xmlView
221-
Assert.Equal("<div><!-- this is a test --><h1>Header</h1><p><br/><strong>Ipsum</strong> dollar</p></div>", html)
221+
Assert.Equal("<div><!-- this is a test --><h1>Header</h1><p><br/><strong>Ipsum</strong> dollar</p></div>", html)
222+
223+
[<Fact>]
224+
let ``Fragment works correctly`` () =
225+
let withFragment =
226+
Html.div [
227+
prop.className "test-class"
228+
prop.children [
229+
Html.p "test outer p"
230+
React.fragment [
231+
Html.p "test inner p"
232+
Html.span "test span"
233+
]
234+
]
235+
]
236+
237+
let html =
238+
withFragment
239+
|> Render.htmlView
240+
Assert.Equal("<div class=\"test-class\"><p>test outer p</p><p>test inner p</p><span>test span</span></div>", html)

0 commit comments

Comments
 (0)