From f55e97f663e7c209c5d11c64db263cdb56fd32ef Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 26 Apr 2023 21:59:18 +0400 Subject: [PATCH] fix(down): remove validation for last breakpoint (#1472) --- core/breakpoints.js | 1 - core/breakpoints.spec.js | 10 ++-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/core/breakpoints.js b/core/breakpoints.js index a5f21d9c..42166edf 100644 --- a/core/breakpoints.js +++ b/core/breakpoints.js @@ -19,7 +19,6 @@ exports.createBreakpoints = ({ breakpoints, errorPrefix } = {}) => { const down = (max) => { validation.throwIsInvalidName(max); validation.throwIsValueIsZero(max); - validation.throwIsLastBreakpoint(max); return calcMaxWidth(breakpoints[max]); }; diff --git a/core/breakpoints.spec.js b/core/breakpoints.spec.js index f3ea4419..3adb59e6 100644 --- a/core/breakpoints.spec.js +++ b/core/breakpoints.spec.js @@ -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) ); }); });