Skip to content

Commit

Permalink
test: Add a version without holes of the #256 regression test
Browse files Browse the repository at this point in the history
When an element has no holes inside it, code generation uses
HtmlNode.OuterHtml instead of HtmlAttribute.Name. So both cases
must be checked.
  • Loading branch information
Tarmil committed May 15, 2022
1 parent fca8b23 commit a607339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion tests/Unit.Client/Templating.fs
Expand Up @@ -173,8 +173,12 @@ type BindTester() =

type ``Regression #11`` = Template<"""<span class="${Hole}">${Hole}</span>""">

type ``Regression #256`` = Template<"""<svg width="200" height="200" version="1.1" viewBox="0 0 100 100" class="regression-256" xmlns="http://www.w3.org/2000/svg">
type ``Regression #256`` = Template<"""
<svg width="200" height="200" version="1.1" viewBox="0 0 100 100" class="regression-256-with-holes" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="45" fill="${CircleFill}" stroke="${CircleStroke}" stroke-width="3"/>
</svg>
<svg width="200" height="200" version="1.1" viewBox="0 0 100 100" class="regression-256-without-holes" xmlns="http://www.w3.org/2000/svg">
<circle cx="50" cy="50" r="45" fill="red" stroke="black" stroke-width="3"/>
</svg>""">

let Tests() =
Expand Down
6 changes: 4 additions & 2 deletions tests/Unit/Tests/Templating.fs
Expand Up @@ -236,5 +236,7 @@ module Templating =

[<Test>]
let ``Regression #256: attribute name case is respected``() =
test <@ elt.ByClass("regression-256").GetDomAttribute("viewbox") |> isNull @>
test <@ elt.ByClass("regression-256").GetDomAttribute("viewBox") = "0 0 100 100" @>
test <@ elt.ByClass("regression-256-with-holes").GetDomAttribute("viewbox") |> isNull @>
test <@ elt.ByClass("regression-256-with-holes").GetDomAttribute("viewBox") = "0 0 100 100" @>
test <@ elt.ByClass("regression-256-without-holes").GetDomAttribute("viewbox") |> isNull @>
test <@ elt.ByClass("regression-256-without-holes").GetDomAttribute("viewBox") = "0 0 100 100" @>

0 comments on commit a607339

Please sign in to comment.