@frontify/guideline-blocks-settings 0.31.0 → 0.31.2

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
@@ -1,5 +1,21 @@
1
1
  # @frontify/guideline-blocks-settings
2
2
 
3
+ ## 0.31.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`68a9298`](https://github.com/Frontify/brand-sdk/commit/68a9298df9e2177e70333f47dc433a056d76625b)]:
8
+ - @frontify/app-bridge@3.1.0
9
+
10
+ ## 0.31.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [#708](https://github.com/Frontify/brand-sdk/pull/708) [`e2a0023`](https://github.com/Frontify/brand-sdk/commit/e2a0023256001dcc64a597f6dcd9df66a1c9f186) Thanks [@ragi96](https://github.com/ragi96)! - feat: add support for @frontify/app-bridge 4.0.0-alpha.0
15
+
16
+ - Updated dependencies [[`c98d8c4`](https://github.com/Frontify/brand-sdk/commit/c98d8c414b2cdd00d4945f0c29581370b0a7daa0)]:
17
+ - @frontify/app-bridge@3.0.4
18
+
3
19
  ## 0.31.0
4
20
 
5
21
  ### Minor Changes
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- /// <reference types="react" />
2
-
3
1
  import { AnyObject } from '@udecode/plate';
4
2
  import { AppBridgeBlock } from '@frontify/app-bridge';
5
3
  import type { AppBridgeTheme } from '@frontify/app-bridge';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontify/guideline-blocks-settings",
3
- "version": "0.31.0",
3
+ "version": "0.31.2",
4
4
  "description": "Provides types and helpers for the guideline block development",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.js",
@@ -65,7 +65,7 @@
65
65
  "@frontify/sidebar-settings": "^0.9.1"
66
66
  },
67
67
  "peerDependencies": {
68
- "@frontify/app-bridge": "^3.0.0",
68
+ "@frontify/app-bridge": "^3.0.0 || ^4.0.0-alpha.0",
69
69
  "react": "^18",
70
70
  "react-dom": "^18"
71
71
  },
package/setupTests.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  /* (c) Copyright Frontify Ltd., all rights reserved. */
2
2
 
3
- import { afterEach, vi } from 'vitest';
3
+ import { afterEach, beforeAll, vi } from 'vitest';
4
+ import { configure } from '@testing-library/react';
4
5
 
5
6
  vi.stubGlobal('crypto', {
6
7
  getRandomValues: vi.fn(),
7
8
  });
8
9
 
10
+ beforeAll(() => {
11
+ configure({ testIdAttribute: 'data-test-id' });
12
+ });
13
+
9
14
  afterEach(() => {
10
15
  vi.restoreAllMocks();
11
16
  });
@@ -43,6 +43,12 @@ const isPre302Stub = async (appBridge: AppBridgeBlock): Promise<boolean> => {
43
43
  return context === undefined;
44
44
  };
45
45
 
46
+ const hasOpenAssetChooser = (
47
+ appBridge: AppBridgeBlock,
48
+ ): appBridge is AppBridgeBlock & { openAssetChooser: SinonStub } => {
49
+ return 'openAssetChooser' in appBridge;
50
+ };
51
+
46
52
  describe('Attachments', () => {
47
53
  it('renders attachments flyout if it is in edit mode', () => {
48
54
  mount(<Attachments appBridge={getAppBridgeBlockStub({ editorState: true })} />);
@@ -94,7 +100,7 @@ describe('Attachments', () => {
94
100
  editorState: true,
95
101
  });
96
102
 
97
- if (await isPre302Stub(appBridge)) {
103
+ if ((await isPre302Stub(appBridge)) && hasOpenAssetChooser(appBridge)) {
98
104
  (appBridge.openAssetChooser as SinonStub) = cy.stub().callsArgWith(0, AssetDummy.with(4));
99
105
  }
100
106
 
@@ -8,11 +8,7 @@ import { AttachmentsProvider, useAttachments, useAttachmentsContext, withAttachm
8
8
 
9
9
  const MOCK_SETTINGS_ID = 'attachments';
10
10
 
11
- /**
12
- * @vitest-environment happy-dom
13
- */
14
-
15
- describe('useAttachments', () => {
11
+ describe('useAttachments', async () => {
16
12
  it('should have 1 attachment if attachment is added', async () => {
17
13
  const STUB_WITH_NO_ASSETS = getAppBridgeBlockStub({
18
14
  blockId: 1,
@@ -115,7 +111,7 @@ describe('withAttachmentsProvider', () => {
115
111
  return (
116
112
  <ul>
117
113
  {context.attachments.map((attachment) => (
118
- <li key={attachment.id} role="list">
114
+ <li key={attachment.id} data-test-id="item-test">
119
115
  {attachment.id}
120
116
  </li>
121
117
  ))}
@@ -123,8 +119,8 @@ describe('withAttachmentsProvider', () => {
123
119
  );
124
120
  }, MOCK_SETTINGS_ID);
125
121
 
126
- const { getAllByRole } = render(<Component appBridge={STUB_WITH_THREE_ASSETS} />);
122
+ const { getAllByTestId } = render(<Component appBridge={STUB_WITH_THREE_ASSETS} />);
127
123
 
128
- await waitFor(() => expect(getAllByRole('list')).toHaveLength(3));
124
+ await waitFor(() => expect(getAllByTestId('item-test')).toHaveLength(3));
129
125
  });
130
126
  });