@elementor/editor-responsive 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.11.1](https://github.com/elementor/elementor-packages/compare/@elementor/editor-responsive@0.11.0...@elementor/editor-responsive@0.11.1) (2024-08-05)
7
+
8
+ ### Bug Fixes
9
+
10
+ - publish only necessary files to npm ([#226](https://github.com/elementor/elementor-packages/issues/226)) ([d808e2f](https://github.com/elementor/elementor-packages/commit/d808e2f60eb7ca2d7b8560d0b79c0e62c2f969a8))
11
+
6
12
  # [0.11.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-responsive@0.10.6...@elementor/editor-responsive@0.11.0) (2024-07-18)
7
13
 
8
14
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-responsive",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "https://github.com/elementor/elementor-packages.git",
21
+ "url": "git+https://github.com/elementor/elementor-packages.git",
22
22
  "directory": "packages/libs/editor-responsive"
23
23
  },
24
24
  "bugs": {
@@ -27,16 +27,23 @@
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
+ "files": [
31
+ "README.md",
32
+ "CHANGELOG.md",
33
+ "/dist",
34
+ "/src",
35
+ "!**/__tests__"
36
+ ],
30
37
  "scripts": {
31
38
  "build": "tsup --config=../../tsup.build.ts",
32
39
  "dev": "tsup --config=../../tsup.dev.ts"
33
40
  },
34
41
  "dependencies": {
35
- "@elementor/editor-v1-adapters": "^0.8.0",
42
+ "@elementor/editor-v1-adapters": "^0.8.1",
36
43
  "@wordpress/i18n": "^4.45.0"
37
44
  },
38
45
  "peerDependencies": {
39
46
  "react": "^18.3.1"
40
47
  },
41
- "gitHead": "7d626115b07f3425b679f7508230f7776f3fe17b"
48
+ "gitHead": "f4ca33da0842a29d83736d0a173633085edddaee"
42
49
  }
@@ -1,20 +0,0 @@
1
- import { renderHook } from '@testing-library/react';
2
- import { useActivateBreakpoint } from '../use-activate-breakpoint';
3
- import { __privateRunCommand as runCommand } from '@elementor/editor-v1-adapters';
4
-
5
- jest.mock( '@elementor/editor-v1-adapters', () => ( {
6
- __privateRunCommand: jest.fn(),
7
- } ) );
8
-
9
- describe( 'useActivateBreakpoints', () => {
10
- it( 'should activate a breakpoint', () => {
11
- // Act.
12
- const { result } = renderHook( useActivateBreakpoint );
13
-
14
- result.current( 'tablet' );
15
-
16
- // Assert.
17
- expect( jest.mocked( runCommand ) ).toHaveBeenCalledTimes( 1 );
18
- expect( jest.mocked( runCommand ) ).toHaveBeenCalledWith( 'panel/change-device-mode', { device: 'tablet' } );
19
- } );
20
- } );
@@ -1,50 +0,0 @@
1
- import { act, renderHook } from '@testing-library/react';
2
- import { useActiveBreakpoint } from '../use-active-breakpoint';
3
- import { BreakpointId, ExtendedWindow } from '../../types';
4
- import { dispatchWindowEvent } from 'test-utils';
5
-
6
- describe( 'useActiveBreakpoint', () => {
7
- function setActiveBreakpoint( active: BreakpointId ) {
8
- const extendedWindow = window as unknown as ExtendedWindow;
9
-
10
- extendedWindow.elementor = {
11
- channels: {
12
- deviceMode: {
13
- request: () => {
14
- return active;
15
- },
16
- },
17
- },
18
- };
19
-
20
- dispatchWindowEvent( 'elementor/device-mode/change' );
21
- }
22
-
23
- it( 'should return null when no breakpoint is active', () => {
24
- // Arrange.
25
- setActiveBreakpoint( undefined as never );
26
-
27
- // Act.
28
- const { result } = renderHook( useActiveBreakpoint );
29
-
30
- // Assert.
31
- expect( result.current ).toEqual( null );
32
- } );
33
-
34
- it( 'should return the active breakpoint', () => {
35
- // Arrange.
36
- setActiveBreakpoint( 'mobile' );
37
-
38
- // Act.
39
- const { result } = renderHook( useActiveBreakpoint );
40
-
41
- // Assert.
42
- expect( result.current ).toEqual( 'mobile' );
43
-
44
- // Act.
45
- act( () => setActiveBreakpoint( 'tablet' ) );
46
-
47
- // Assert.
48
- expect( result.current ).toEqual( 'tablet' );
49
- } );
50
- } );
@@ -1,90 +0,0 @@
1
- import { useBreakpoints } from '../use-breakpoints';
2
- import { renderHook } from '@testing-library/react';
3
- import { ExtendedWindow, V1Breakpoints } from '../../types';
4
-
5
- describe( 'useBreakpoints', () => {
6
- function setBreakpoints( breakpoints: Partial< V1Breakpoints > ) {
7
- const extendedWindow = window as unknown as ExtendedWindow;
8
-
9
- extendedWindow.elementor = {
10
- config: {
11
- responsive: {
12
- breakpoints: breakpoints as V1Breakpoints,
13
- },
14
- },
15
- };
16
- }
17
-
18
- it( 'should return an empty array if no breakpoints are available', () => {
19
- // Arrange.
20
- setBreakpoints( {} as never );
21
-
22
- // Act.
23
- const { result } = renderHook( useBreakpoints );
24
-
25
- // Assert.
26
- expect( result.current ).toEqual( [] );
27
- } );
28
-
29
- it( 'should filter out inactive breakpoints', () => {
30
- // Arrange.
31
- setBreakpoints( {
32
- tablet: {
33
- is_enabled: false,
34
- value: 1024,
35
- label: 'Tablet Portrait',
36
- direction: 'max',
37
- },
38
- mobile: {
39
- is_enabled: true,
40
- value: 767,
41
- label: 'Mobile Portrait',
42
- direction: 'max',
43
- },
44
- } );
45
-
46
- // Act.
47
- const { result } = renderHook( useBreakpoints );
48
-
49
- // Assert.
50
- expect( result.current ).toEqual( [
51
- { id: 'desktop', label: 'Desktop' },
52
- { id: 'mobile', label: 'Mobile Portrait', width: 767, type: 'max-width' },
53
- ] );
54
- } );
55
-
56
- it( 'should return all breakpoints sorted by size', () => {
57
- // Arrange.
58
- setBreakpoints( {
59
- tablet: {
60
- is_enabled: true,
61
- value: 1024,
62
- label: 'Tablet Portrait',
63
- direction: 'max',
64
- },
65
- mobile: {
66
- is_enabled: true,
67
- value: 767,
68
- label: 'Mobile Portrait',
69
- direction: 'max',
70
- },
71
- widescreen: {
72
- is_enabled: true,
73
- value: 2400,
74
- label: 'Widescreen',
75
- direction: 'min',
76
- },
77
- } );
78
-
79
- // Act.
80
- const { result } = renderHook( useBreakpoints );
81
-
82
- // Assert.
83
- expect( result.current ).toEqual( [
84
- { id: 'widescreen', label: 'Widescreen', width: 2400, type: 'min-width' },
85
- { id: 'desktop', label: 'Desktop' },
86
- { id: 'tablet', label: 'Tablet Portrait', width: 1024, type: 'max-width' },
87
- { id: 'mobile', label: 'Mobile Portrait', width: 767, type: 'max-width' },
88
- ] );
89
- } );
90
- } );