diff options
Diffstat (limited to 'resources/resource_transformers/tocss')
-rw-r--r-- | resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go | 37 | ||||
-rw-r--r-- | resources/resource_transformers/tocss/scss/scss_integration_test.go | 37 |
2 files changed, 74 insertions, 0 deletions
diff --git a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go index dd4c1e5ca..4d48b3b6a 100644 --- a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go +++ b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go @@ -19,6 +19,7 @@ import ( "github.com/bep/logg" qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/htesting" "github.com/gohugoio/hugo/hugolib" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass" ) @@ -525,3 +526,39 @@ T1: {{ $r.Content }} b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:13:0: number`) b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:14:0: number`) } + +// Note: This test is more or less duplicated in both of the SCSS packages (libsass and dartsass). +func TestBootstrap(t *testing.T) { + t.Parallel() + if !dartsass.Supports() { + t.Skip() + } + if !htesting.IsCI() { + t.Skip("skip (slow) test in non-CI environment") + } + + files := ` +-- hugo.toml -- +disableKinds = ["term", "taxonomy", "section", "page"] +[module] +[[module.imports]] +path="github.com/gohugoio/hugo-mod-bootstrap-scss/v5" +-- go.mod -- +module github.com/gohugoio/tests/testHugoModules +-- assets/scss/main.scss -- +@import "bootstrap/bootstrap"; +-- layouts/index.html -- +{{ $cssOpts := (dict "transpiler" "dartsass" ) }} +{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }} +Styles: {{ $r.RelPermalink }} + ` + + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: files, + NeedsOsFS: true, + }).Build() + + b.AssertFileContent("public/index.html", "Styles: /scss/main.css") +} diff --git a/resources/resource_transformers/tocss/scss/scss_integration_test.go b/resources/resource_transformers/tocss/scss/scss_integration_test.go index 4d7d9d710..c193ca8af 100644 --- a/resources/resource_transformers/tocss/scss/scss_integration_test.go +++ b/resources/resource_transformers/tocss/scss/scss_integration_test.go @@ -20,6 +20,7 @@ import ( qt "github.com/frankban/quicktest" + "github.com/gohugoio/hugo/htesting" "github.com/gohugoio/hugo/hugolib" "github.com/gohugoio/hugo/resources/resource_transformers/tocss/scss" ) @@ -290,3 +291,39 @@ T1: {{ $r.Content }} b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo's New Roman}p{color:blue;font-size:var 24px}b{color:green}`) } + +// Note: This test is more or less duplicated in both of the SCSS packages (libsass and dartsass). +func TestBootstrap(t *testing.T) { + t.Parallel() + if !scss.Supports() { + t.Skip() + } + if !htesting.IsCI() { + t.Skip("skip (slow) test in non-CI environment") + } + + files := ` +-- hugo.toml -- +disableKinds = ["term", "taxonomy", "section", "page"] +[module] +[[module.imports]] +path="github.com/gohugoio/hugo-mod-bootstrap-scss/v5" +-- go.mod -- +module github.com/gohugoio/tests/testHugoModules +-- assets/scss/main.scss -- +@import "bootstrap/bootstrap"; +-- layouts/index.html -- +{{ $cssOpts := (dict "transpiler" "libsass" ) }} +{{ $r := resources.Get "scss/main.scss" | toCSS $cssOpts }} +Styles: {{ $r.RelPermalink }} + ` + + b := hugolib.NewIntegrationTestBuilder( + hugolib.IntegrationTestConfig{ + T: t, + TxtarString: files, + NeedsOsFS: true, + }).Build() + + b.AssertFileContent("public/index.html", "Styles: /scss/main.css") +} |