Skip to content

Commit

Permalink
Output a blank media query if xxlarge down is used, since 'xxlarge do…
Browse files Browse the repository at this point in the history
…wn' basically means 'every screen size'
  • Loading branch information
gakimball committed Jan 26, 2016
1 parent 8252c2b commit 8b2f710
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
4 changes: 3 additions & 1 deletion scss/util/_breakpoint.scss
Expand Up @@ -101,7 +101,9 @@ $breakpoint-classes: (small medium large) !default;
// Skip media query creation if input value is exactly "0 down",
// unless the function was called as "small down", in which case it's just "small only"
@if $named or $bp > 0em {
$str: $str + '(max-width: #{$max})';
@if $max != null {
$str: $str + '(max-width: #{$max})';
}
}
}

Expand Down
34 changes: 20 additions & 14 deletions test/sass/_breakpoint.scss
Expand Up @@ -4,7 +4,7 @@
@import '../../scss/util/breakpoint';

@include test-module('Breakpoint') {

@include test('Breakpoint (Named to Em) [function]') {
$test: breakpoint(medium);
$expect: '(min-width: 40em)';
Expand All @@ -25,7 +25,7 @@
@include test('Breakpoint (Only Range) [function]') {
$test: breakpoint(medium only);
$expect: '(min-width: 40em) and (max-width: 63.9375em)';

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

Expand All @@ -34,26 +34,32 @@

@include assert-equal($test, $expect,
'Creates a min/max-width range out of a named breakpoint');

@include assert-equal($test-lowest, $expect-lowest,
'Creates a max-width range if the breakpoint is the lowest');

@include assert-equal($test-highest, $expect-highest,
'Creates a min-width range if the breakpoint is the highest');
}

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

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

$test_small: breakpoint(small down);
$expect_small: '(max-width: 39.9375em)';

@include assert-equal($test_small, $expect_small,
$test-lowest: breakpoint(small down);
$expect-lowest: '(max-width: 39.9375em)';

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

$test-highest: breakpoint(xxlarge down);
$expect-highest: '';

@include assert-equal($test-highest, $expect-highest,
'Skips media query creation for xxlarge down');
}

@include test('Breakpoint (Value Down Range) [function]') {
Expand Down Expand Up @@ -111,10 +117,10 @@

@include assert-equal($test_next, $expect_next,
'Returns the next value in a map');

$test_last: -zf-map-next($input, three);
$expect_last: null;

@include assert-equal($test_last, $expect_last,
'Returns null if the key is last in the map');

Expand All @@ -135,7 +141,7 @@

@include assert-equal($test_kittens, $expect_kittens,
'Given a non-existant breakpoint name, return null');

$test_match: -zf-get-bp-val($config, large);
$expect_match: 1;

Expand Down

0 comments on commit 8b2f710

Please sign in to comment.