1
0
mirror of https://github.com/tabler/tabler.git synced 2026-08-08 04:12:26 +04:00
Files
tabler/core/scss/tests/_breakpoints.test.scss
T

51 lines
1.7 KiB
SCSS

// Priority 4 — unit tests for the responsive breakpoint helpers. These are the
// "needs config" tier: they default to the global `$grid-breakpoints`, but every
// function also accepts an explicit `$breakpoints` map, so the tests pass a
// local fixture map and stay independent of the project variables.
//
// `breakpoint-prev` lives in mixins/_functions.scss; the rest live in
// mixins/bootstrap/_breakpoints.scss.
@use '../mixins/functions' as fn;
@use '../mixins/bootstrap/breakpoints' as *;
$grid: (
xs: 0,
sm: 576px,
md: 768px,
lg: 992px,
xl: 1200px,
);
@include describe('breakpoint-next / breakpoint-prev') {
@include it('returns the neighbouring breakpoint name') {
@include assert-equal(breakpoint-next(md, $grid), lg);
@include assert-equal(fn.breakpoint-prev(md, $grid), sm);
}
@include it('returns null past the last / before the first breakpoint') {
@include assert-equal(breakpoint-next(xl, $grid), null);
@include assert-equal(fn.breakpoint-prev(xs, $grid), null);
}
}
@include describe('breakpoint-min') {
@include it('returns the min width, or null for the zero breakpoint') {
@include assert-equal(breakpoint-min(md, $grid), 768px);
@include assert-equal(breakpoint-min(xs, $grid), null);
}
}
@include describe('breakpoint-max') {
@include it('subtracts 0.02px to avoid min/max overlap') {
@include assert-equal(breakpoint-max(md, $grid), 767.98px);
}
}
@include describe('breakpoint-infix') {
@include it('is blank for the smallest breakpoint and dash-prefixed otherwise') {
@include assert-equal(breakpoint-infix(xs, $grid), '');
@include assert-equal(breakpoint-infix(md, $grid), '-md');
}
}