diff --git a/src/components/base/datepicker/datepicker.stories.js b/src/components/base/datepicker/datepicker.stories.js index d08d39951c4413351604fbc4dc52b313a1160c0a..e4c2b7c1f32bba02866df825d6db4089e251bb03 100644 --- a/src/components/base/datepicker/datepicker.stories.js +++ b/src/components/base/datepicker/datepicker.stories.js @@ -3,7 +3,7 @@ import documentedStoriesOf from '../../../../documentation/documented_stories'; import readme from './datepicker.md'; import GlDatepicker from './datepicker.vue'; -const currentYear = new Date().getFullYear(); +const currentYear = 2020; const defaultDate = new Date(currentYear, 0, 15); const defaultMinDate = new Date(currentYear, 0, 1); diff --git a/src/utils/breakpoints.js b/src/utils/breakpoints.js index 8a7b791c9c0cb01dda979607efa9da9a72b14d4a..18cf6f1473573fc5ca7c512e597e950c01480c69 100644 --- a/src/utils/breakpoints.js +++ b/src/utils/breakpoints.js @@ -11,7 +11,7 @@ const BreakpointInstance = { getBreakpointSize() { const windowWidth = this.windowWidth(); - const breakpoint = Object.keys(breakpoints).find(key => windowWidth > breakpoints[key]); + const breakpoint = Object.keys(breakpoints).find(key => windowWidth >= breakpoints[key]); return breakpoint; }, diff --git a/tests/components/base/pagination.spec.js b/tests/components/base/pagination.spec.js index d7c45f608f774a78f618ea0d447e4ff8c7ccb717..6ea3840f5d71158ad502b6341e185c2d3981c1db 100644 --- a/tests/components/base/pagination.spec.js +++ b/tests/components/base/pagination.spec.js @@ -42,14 +42,18 @@ describe('pagination component', () => { it('should change pagination limits on resize', () => { createComponent(); - mockResizeWidth(breakpoints.sm); + mockResizeWidth(breakpoints.xs); expect(wrapper.vm.paginationLimit).toBe(0); expect(wrapper.vm.maxAdjacentPages).toBe(0); - mockResizeWidth(breakpoints.md); + mockResizeWidth(breakpoints.sm); expect(wrapper.vm.paginationLimit).toBe(3); expect(wrapper.vm.maxAdjacentPages).toBe(1); + mockResizeWidth(breakpoints.md); + expect(wrapper.vm.paginationLimit).toBe(9); + expect(wrapper.vm.maxAdjacentPages).toBe(4); + mockResizeWidth(breakpoints.lg); expect(wrapper.vm.paginationLimit).toBe(9); expect(wrapper.vm.maxAdjacentPages).toBe(4); @@ -229,7 +233,7 @@ describe('pagination component', () => { }); it('shows page 8 and collapses both sides on mobile', () => { - mockResizeWidth(breakpoints.sm); + mockResizeWidth(breakpoints.xs); const buttons = findButtons(); expect(buttons.length).toBe(7); expect(buttons.at(0).text()).toBe(wrapper.vm.prevText);