Skip to content

Commit

Permalink
Merge pull request foundation#10978 from JasonMiller/breakpoint-mixin…
Browse files Browse the repository at this point in the history
…-max-width-values

Breakpoint Mixin `max-width` Values
  • Loading branch information
ncoden authored Mar 30, 2018
2 parents 7f2d207 + cc92794 commit 78bda61
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions scss/components/_visibility.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/// @param {Keyword} $size - Breakpoint to use. **Must be a breakpoint defined in `$breakpoints`.**
@mixin show-for($size) {
$size: map-get($breakpoints, $size);
$size: -zf-bp-to-em($size) - (1 / 16);
$size: -zf-bp-to-em($size) - .00001;

@include breakpoint($size down) {
display: none !important;
Expand All @@ -20,7 +20,7 @@
$upper-bound-size: -zf-map-next($breakpoints, $size);

// more often than not this will be correct, just one time round the loop it won't so set in scope here
$lower-bound: -zf-bp-to-em($lower-bound-size) - (1 / 16);
$lower-bound: -zf-bp-to-em($lower-bound-size) - .00001;
// test actual lower-bound-size, if 0 set it to 0em
@if strip-unit($lower-bound-size) == 0 {
$lower-bound: -zf-bp-to-em($lower-bound-size);
Expand Down
2 changes: 1 addition & 1 deletion scss/util/_breakpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ $breakpoint-classes: (small medium large) !default;
// Convert any pixel, rem, or unitless value to em
$bp: -zf-bp-to-em($bp);
@if $bp-max {
$bp-max: -zf-bp-to-em($bp-max) - (1/16);
$bp-max: -zf-bp-to-em($bp-max) - .00001;
}

// Conditions to skip media query creation
Expand Down
9 changes: 4 additions & 5 deletions test/sass/_breakpoint.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

@include test('Breakpoint (Only Range) [function]') {
$test: breakpoint(medium only);
$expect: '(min-width: 40em) and (max-width: 63.9375em)';
$expect: '(min-width: 40em) and (max-width: 63.99999em)';

$test-lowest: breakpoint(small only);
$expect-lowest: '(max-width: 39.9375em)';
$expect-lowest: '(max-width: 39.99999em)';

$test-highest: breakpoint(xxlarge only);
$expect-highest: '(min-width: 90em)';
Expand All @@ -44,13 +44,13 @@

@include test('Breakpoint (Named Down Range) [function]') {
$test: breakpoint(medium down);
$expect: '(max-width: 63.9375em)';
$expect: '(max-width: 63.99999em)';

@include assert-equal($test, $expect,
'Creates a down range out of a medium breakpoint');

$test-lowest: breakpoint(small down);
$expect-lowest: '(max-width: 39.9375em)';
$expect-lowest: '(max-width: 39.99999em)';

@include assert-equal($test-lowest, $expect-lowest,
'Creates a down range out of a small breakpoint');
Expand Down Expand Up @@ -156,5 +156,4 @@
@include assert-equal(-zf-get-bp-val($config, xlarge), 1,
'Given a nearby breakpoint, returns the next lowest value');
}

}

0 comments on commit 78bda61

Please sign in to comment.