]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Added True Sass testing, converted unit function tests
authorcolin-marshall <colin.michael.marshall@gmail.com>
Tue, 12 Jan 2016 07:16:26 +0000 (00:16 -0700)
committercolin-marshall <colin.michael.marshall@gmail.com>
Tue, 12 Jan 2016 07:22:07 +0000 (00:22 -0700)
package.json
test/sass/_unit.scss
test/sass/test_sass.js [new file with mode: 0644]

index 81eba7e36761c639c5a4178a689d3f40a1fcf61b..66b323f62793353e18030ecbbe5468c596703fd5 100644 (file)
@@ -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": {
index 34c1accce882b7651724883ed8618e45fd8931c2..c7205fb30f818cbb657741a89bb7b874f86f3a83 100755 (executable)
@@ -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 (file)
index 0000000..0d186ea
--- /dev/null
@@ -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