]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
don't skip 'small down' value for breakpoint 7632/head
authorTvrtko <tvrtkom@gmail.com>
Sat, 19 Dec 2015 11:47:27 +0000 (12:47 +0100)
committerTvrtko <tvrtkom@gmail.com>
Sat, 19 Dec 2015 11:47:27 +0000 (12:47 +0100)
+ sass tests
+ revert to comparison with unitless 0

scss/util/_breakpoint.scss
test/sass/_breakpoint.scss

index 51bb9046965138ba2a4d03bb66b694b1fa8c5f5d..b4e4d09c9f85a78a872dc8e0bbb1ef64deaefc21 100644 (file)
@@ -73,8 +73,8 @@ $breakpoint-classes: (small medium large) !default;
     $bp-max: -zf-bp-to-em($bp-max) - (1/16);
   }
 
-  // Skip media query creation if the input is "0 up" or "0 down"
-  @if $bp > 0em or $dir == 'only' {
+  // Skip media query creation if the input is "0 up"
+  @if $bp > 0 or $dir == 'only' or $dir == 'down' {
     // `only` ranges use the format `(min-width: n) and (max-width: n)`
     @if $dir == 'only' {
       @if $named == true {
@@ -101,11 +101,14 @@ $breakpoint-classes: (small medium large) !default;
         $max: $bp;
       }
 
-      $str: $str + '(max-width: #{$max})';
+      // Skip media query creation if input value is exactly "0 down" but don't "small down"
+      @if $named or $bp > 0 {
+        $str: $str + '(max-width: #{$max})';
+      }
     }
 
     // `up` ranges use the format `(min-width: n)`
-    @else if $bp > 0em {
+    @else if $bp > 0 {
       $str: $str + '(min-width: #{$bp})';
     }
   }
index a160ff5b341b7fb0921975812e7050be81ab4495..47c58beb7ce754b1a6e21e364e3ce5b657ce62de 100755 (executable)
   }
 
   @include it('creates a down range out of a named breakpoint') {
-    $actual: breakpoint(medium down);
-    $expected: '(max-width: 63.9375em)';
+    $actual_medium: breakpoint(medium down);
+    $expected_medium: '(max-width: 63.9375em)';
 
-    @include should(expect($actual), to(be($expected)));
+    @include should(expect($actual_medium), to(be($expected_medium)));
+
+    $actual_small: breakpoint(small down);
+    $expected_small: '(max-width: 39.9375em)';
+
+    @include should(expect($actual_small), to(be($expected_small)));
   }
 
   @include it('creates a down range out of a pixel, rem or em value') {
@@ -41,7 +46,6 @@
   @include it('returns an empty string for the values zero down or zero up') {
     $expected: '';
 
-    @include should(expect(breakpoint(small down)), to(be($expected)));
     @include should(expect(breakpoint(small up)), to(be($expected)));
     @include should(expect(breakpoint(0 down)), to(be($expected)));
     @include should(expect(breakpoint(0 up)), to(be($expected)));