]> git.maquefel.me Git - brevno-suite/hugo/commitdiff
tocss: Add some more test cases
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 21 Dec 2022 08:17:51 +0000 (09:17 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 21 Dec 2022 10:21:07 +0000 (11:21 +0100)
See #10555

resources/resource_transformers/tocss/dartsass/integration_test.go
resources/resource_transformers/tocss/scss/integration_test.go

index 083cef14f3a72f745dcef33cad9050534e309037..3d7c07ba67d4d9b00c81e2802b5c52008974d4cd 100644 (file)
@@ -290,6 +290,7 @@ func TestOptionVars(t *testing.T) {
 body {
        body {
                background: url(vars.$image) no-repeat center/cover;
+               font-family: vars.$font;
          }       
 }
 
@@ -303,7 +304,8 @@ b {
 }
 -- layouts/index.html --
 {{ $image := "images/hero.jpg" }}
-{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image }}
+{{ $font := "Hugo's New Roman" }}
+{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
 {{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
 {{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
 T1: {{ $r.Content }}
@@ -316,7 +318,7 @@ T1: {{ $r.Content }}
                        NeedsOsFS:   true,
                }).Build()
 
-       b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover}p{color:blue;font-size:24px}b{color:green}`)
+       b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo&#39;s New Roman}p{color:blue;font-size:24px}b{color:green}`)
 }
 
 func TestOptionVarsParams(t *testing.T) {
index 799c70ee591d246b4528df4f5148c83b0adcfa44..d0dd65e20caaa5874570813255467607d979323b 100644 (file)
@@ -263,6 +263,7 @@ func TestOptionVars(t *testing.T) {
 body {
        body {
                background: url($image) no-repeat center/cover;
+               font-family: $font;
          }       
 }
 
@@ -276,7 +277,8 @@ b {
 }
 -- layouts/index.html --
 {{ $image := "images/hero.jpg" }}
-{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image }}
+{{ $font := "Hugo's New Roman" }}
+{{ $vars := dict "$color1" "blue" "$color2" "green" "font_size" "24px" "image" $image "font" $font }}
 {{ $cssOpts := (dict "transpiler" "libsass" "outputStyle" "compressed" "vars" $vars ) }}
 {{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
 T1: {{ $r.Content }}
@@ -289,5 +291,5 @@ T1: {{ $r.Content }}
                        NeedsOsFS:   true,
                }).Build()
 
-       b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover}p{color:blue;font-size:var 24px}b{color:green}`)
+       b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo&#39;s New Roman}p{color:blue;font-size:var 24px}b{color:green}`)
 }