From: Brett Mason Date: Wed, 2 Aug 2017 11:23:22 +0000 (+0100) Subject: Rework Sass unit testing file structure to make it far easier to add new tests by... X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Ffeature%2Fsass-unit-testing;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Rework Sass unit testing file structure to make it far easier to add new tests by having one main Sass test file. --- diff --git a/test/sass/_breakpoint.scss b/test/sass/_breakpoint.scss index d013ac47d..d1b3bc991 100755 --- a/test/sass/_breakpoint.scss +++ b/test/sass/_breakpoint.scss @@ -1,8 +1,3 @@ -@import "true"; - -@import '../../scss/util/unit'; -@import '../../scss/util/breakpoint'; - @include test-module('Breakpoint') { @include test('Breakpoint (Named to Em) [function]') { diff --git a/test/sass/_color.scss b/test/sass/_color.scss index 854ca54b1..b6fd0cc3f 100755 --- a/test/sass/_color.scss +++ b/test/sass/_color.scss @@ -1,8 +1,3 @@ -@import "true"; - -@import '../../scss/global'; -@import '../../scss/util/color'; - @include test-module('Color') { @include test('Foreground (Black) [function]') { diff --git a/test/sass/_components.scss b/test/sass/_components.scss index 0e8bf0e70..9161a55d9 100644 --- a/test/sass/_components.scss +++ b/test/sass/_components.scss @@ -1,10 +1,3 @@ -@import "true"; - -@import '../../scss/util/math'; -@import '../../scss/global'; -@import '../../scss/components/responsive-embed'; -@import '../../scss/grid/grid'; - @include test-module('Components') { @include test('Ratio to Percentage [function]') { diff --git a/test/sass/_selector.scss b/test/sass/_selector.scss index 8e47ae7ca..1d5b21ca0 100755 --- a/test/sass/_selector.scss +++ b/test/sass/_selector.scss @@ -1,9 +1,5 @@ -@import "true"; - -@import '../../scss/util/selector'; - @include test-module('Selector') { - + @include test('Selector [function]') { $test: #{text-inputs(text password)}; $expect: "[type='text'], [type='password']"; diff --git a/test/sass/_unit.scss b/test/sass/_unit.scss index dc66b9690..92bfcd9e6 100755 --- a/test/sass/_unit.scss +++ b/test/sass/_unit.scss @@ -1,7 +1,3 @@ -@import "true"; - -@import '../../scss/util/unit'; - @include test-module('Units') { // Strip Units @@ -32,7 +28,7 @@ @include assert-equal($test, $expect, 'Converts an arbitrary number of values into rem equivalents'); } - + // Breakpoint to Em @include test('Breakpoint To Em [function]') { $expect: 1em; diff --git a/test/sass/_value.scss b/test/sass/_value.scss index 200d79f23..a7049e309 100755 --- a/test/sass/_value.scss +++ b/test/sass/_value.scss @@ -1,8 +1,3 @@ -@import "true"; - -@import '../../scss/util/unit'; -@import '../../scss/util/value'; - @include test-module('Value') { @include test('Value (Not Falsey) [function]') { @@ -109,7 +104,7 @@ ), ); $expect: 'three'; - + @include assert-equal(map-deep-get($map, one, two), $expect, 'Gets a value from a nested map'); } @@ -119,7 +114,7 @@ one: 'two' ); $expect: 'two'; - + @include assert-equal(map-safe-get($map, one), $expect, 'Safely return a value from a map'); } diff --git a/test/sass/test.scss b/test/sass/test.scss new file mode 100644 index 000000000..01e418624 --- /dev/null +++ b/test/sass/test.scss @@ -0,0 +1,13 @@ +// Sass True +@import 'true'; + +// All of Foundation +@import '../../scss/foundation'; + +// Individual tests +@import 'breakpoint'; +@import 'color'; +@import 'components'; +@import 'selector'; +@import 'unit'; +@import 'value'; diff --git a/test/sass/test_sass.js b/test/sass/test_sass.js index 38d0e5d9e..2441e850d 100644 --- a/test/sass/test_sass.js +++ b/test/sass/test_sass.js @@ -1,18 +1,8 @@ var path = require('path'); var sassTrue = require('sass-true'); -// Test Files -var breakpointFile = path.join(__dirname, '_breakpoint.scss'); -var colorFile = path.join(__dirname, '_color.scss'); -var selectorFile = path.join(__dirname, '_selector.scss'); -var unitFile = path.join(__dirname, '_unit.scss'); -var valueFile = path.join(__dirname, '_value.scss'); -var componentsFile = path.join(__dirname, '_components.scss'); +// Test file +var sassFile = path.join(__dirname, 'test.scss'); -// Run Tests -sassTrue.runSass({file: breakpointFile}, describe, it); -sassTrue.runSass({file: colorFile}, describe, it); -sassTrue.runSass({file: selectorFile}, describe, it); -sassTrue.runSass({file: unitFile}, describe, it); -sassTrue.runSass({file: valueFile}, describe, it); -sassTrue.runSass({file: componentsFile}, describe, it); \ No newline at end of file +// Run tests +sassTrue.runSass({file: sassFile}, describe, it);