Skip to content

Commit fa4719d

Browse files
committed
Update tests
1 parent 2069a56 commit fa4719d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

packages/tests/decorators/withBreakpointObserver.spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('The withBreakpointObserver decorator', () => {
9393
it('should re-mount component when deleting both breakpoint options', async () => {
9494
const { fooResponsive, matchMedia } = await getContext();
9595
matchMedia.useMediaQuery('(min-width: 48rem)');
96-
await resizeWindow({ width: 768 });
96+
await resizeWindow({ width: 766 });
9797

9898
expect(fooResponsive[1].$isMounted).toBe(true);
9999
matchMedia.useMediaQuery('(min-width: 64rem)');
@@ -103,7 +103,7 @@ describe('The withBreakpointObserver decorator', () => {
103103
fooResponsive[1].$el.removeAttribute('data-option-active-breakpoints');
104104
fooResponsive[1].$el.removeAttribute('data-option-inactive-breakpoints');
105105
matchMedia.useMediaQuery('(min-width: 48rem)');
106-
await resizeWindow({ width: 768 });
106+
await resizeWindow({ width: 766 });
107107

108108
expect(fooResponsive[1].$isMounted).toBe(true);
109109
});
@@ -181,7 +181,7 @@ describe('The withBreakpointObserver decorator', () => {
181181
`;
182182

183183
matchMedia.useMediaQuery('(min-width: 64rem)');
184-
await resizeWindow({ width: 1024 });
184+
await resizeWindow({ width: 1025 });
185185

186186
await new App1(root).$mount();
187187
expect(fn.mock.calls).toMatchInlineSnapshot(`
@@ -195,7 +195,7 @@ describe('The withBreakpointObserver decorator', () => {
195195
fn.mockClear();
196196

197197
matchMedia.useMediaQuery('(min-width: 48rem)');
198-
await resizeWindow({ width: 768 });
198+
await resizeWindow({ width: 769 });
199199

200200
expect(fn.mock.calls).toMatchInlineSnapshot(`
201201
[
@@ -212,7 +212,7 @@ describe('The withBreakpointObserver decorator', () => {
212212
fn.mockClear();
213213

214214
matchMedia.useMediaQuery('(min-width: 64rem)');
215-
await resizeWindow({ width: 1024 });
215+
await resizeWindow({ width: 1025 });
216216

217217
expect(fn.mock.calls).toMatchInlineSnapshot(`
218218
[

packages/tests/services/ResizeService.spec.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,20 @@ describe('The `useResize` service', () => {
2929
expect(fn).not.toHaveBeenCalled();
3030
});
3131

32-
it('should return the current active breakpoint', () => {
33-
const service = useResize({ s: '0px', m: '1024px', l: '2048px' });
32+
it('should return the current active breakpoint', async () => {
33+
const service = useResize({ s: '0px', m: '1025px', l: '2048px' });
3434
expect(service.props().breakpoints).toEqual(['s', 'm', 'l']);
3535

36-
useMatchMedia('(min-width: 1024px)');
36+
await resizeWindow({ width: 1025 });
37+
useMatchMedia('(min-width: 1025px)');
3738
expect(service.props().activeBreakpoints).toEqual({
3839
s: false,
3940
m: true,
4041
l: false,
4142
});
4243
expect(service.props().breakpoint).toBe('m');
4344

45+
await resizeWindow({ width: 2048 });
4446
useMatchMedia('(min-width: 2048px)');
4547
expect(service.props().activeBreakpoints).toEqual({
4648
s: false,

0 commit comments

Comments
 (0)