From: colin-marshall Date: Tue, 12 Jan 2016 07:16:26 +0000 (-0700) Subject: Added True Sass testing, converted unit function tests X-Git-Tag: v6.1.2~68^2~7^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e52347517a0b566761e4ec88dffd1c3d4be0e1d4;p=thirdparty%2Ffoundation%2Ffoundation-sites.git Added True Sass testing, converted unit function tests --- diff --git a/package.json b/package.json index 81eba7e36..66b323f62 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "require-dir": "^0.3.0", "rimraf": "^2.3.2", "run-sequence": "^1.1.4", + "sass-true": "^2.0.3", "supercollider": "^1.2.0" }, "repository": { diff --git a/test/sass/_unit.scss b/test/sass/_unit.scss index 34c1accce..c7205fb30 100755 --- a/test/sass/_unit.scss +++ b/test/sass/_unit.scss @@ -1,52 +1,45 @@ -@import 'util/unit'; +@import "true"; -@include describe('Strip Unit') { - @include it('strips the unit from a number') { - $actual: strip-unit(20px); - $expected: 20; +@import '../../scss/util/unit'; - @include should(expect($actual), to(be($expected))); - } - @include it('returns the same number when given a unitless value') { - $actual: strip-unit(20); - $expected: 20; +@include test-module('Units') { - @include should(expect($actual), to(be($expected))); + // Strip Units + @include test('Strip Units (Unitless) [function]') { + @include assert-equal(strip-unit(20px), 20, + 'Strips the unit from a number'); + @include assert-equal(strip-unit(20), 20, + 'Returns the same number when given a unitless value'); } -} - -@include describe('Convert to Rem') { - @include it('converts a unit to the equivalent in rems') { - $actual: -zf-to-rem(32, 16); - $expected: 2rem; - @include should(expect($actual), to(be($expected))); + // Convert To Rem + @include test('Convert To Rem [function]') { + @include assert-equal(-zf-to-rem(32, 16), 2rem, + 'Converts a unit to the equivalent in rems'); + @include assert-equal(-zf-to-rem(3rem, 16), 3rem, + 'Keeps rem values the same'); } -} - -@include describe('Convert Rem to Rem') { - @include it('keeps rem values the same') { - $actual: -zf-to-rem(3rem, 16); - $expected: 3rem; - @include should(expect($actual), to(be($expected))); + // Rem Calculator + @include test('Rem Calculator [function]') { + $test: rem-calc((8 16 32 64), 16); + $expect: 0.5rem 1rem 2rem 4rem; + @include assert-equal($test, $expect, + 'Converts an arbitrary number of values into rem equivalents'); } -} - -@include describe('Rem Calculator') { - @include it('converts an arbitrary number of values into rem equivalents') { - $actual: rem-calc((8 16 32 64), 16); - $expected: 0.5rem 1rem 2rem 4rem; - - @include should(expect($actual), to(be($expected))); + + // Breakpoint to Em + @include test('Breakpoint To Em [function]') { + @include assert-equal(-zf-bp-to-em(16), 1em, + 'Converts a unitless value to em'); + @include assert-equal(-zf-bp-to-em(16px), 1em, + 'Converts a pixel value to em'); + @include assert-equal(-zf-bp-to-em(1rem), 1em, + 'Converts a rem value to em'); + @include assert-equal(-zf-bp-to-em(1em), 1em, + 'Converts an em value to em'); } -} -@include describe('Breakpoint to Em') { - @include it('converts a unitless, pixel, or rem value to em') { - @include should(expect(-zf-bp-to-em(16)), to(be(1em))); - @include should(expect(-zf-bp-to-em(16px)), to(be(1em))); - @include should(expect(-zf-bp-to-em(1rem)), to(be(1em))); - @include should(expect(-zf-bp-to-em(1em)), to(be(1em))); - } } + +@include report; \ No newline at end of file diff --git a/test/sass/test_sass.js b/test/sass/test_sass.js new file mode 100644 index 000000000..0d186eadd --- /dev/null +++ b/test/sass/test_sass.js @@ -0,0 +1,8 @@ +var path = require('path'); +var sassTrue = require('sass-true'); + +// Test Files +var unitFile = path.join(__dirname, '_unit.scss'); + +// Run Tests +sassTrue.runSass({file: unitFile}, describe, it); \ No newline at end of file