Skip to content

Commit

Permalink
fix(down): remove validation for last breakpoint (#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
mg901 authored Apr 26, 2023
1 parent 2623ef5 commit f55e97f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
1 change: 0 additions & 1 deletion core/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ exports.createBreakpoints = ({ breakpoints, errorPrefix } = {}) => {
const down = (max) => {
validation.throwIsInvalidName(max);
validation.throwIsValueIsZero(max);
validation.throwIsLastBreakpoint(max);

return calcMaxWidth(breakpoints[max]);
};
Expand Down
10 changes: 2 additions & 8 deletions core/breakpoints.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,9 @@ describe('core/create-breakpoints', () => {
expect(breakpointsApi.down('xl')).toBe(
calcMaxWidth(DEFAULT_BREAKPOINTS.xl)
);
});

it('should throw an error when given the last breakpoint name', () => {
const LAST_BREAKPOINT_NAME = 'xxl';

expect(() => {
breakpointsApi.down(LAST_BREAKPOINT_NAME);
}).toThrow(
`${ERROR_PREFIX}\`${LAST_BREAKPOINT_NAME}\` doesn't have a maximum width. Use \`xl\`. See https://github.com/mg901/styled-breakpoints/issues/4 .`
expect(breakpointsApi.down('xxl')).toBe(
calcMaxWidth(DEFAULT_BREAKPOINTS.xxl)
);
});
});
Expand Down

0 comments on commit f55e97f

Please sign in to comment.