@builder.io/react 2.0.11-3 → 2.0.11-5
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/dist/builder-react-lite.cjs.js +1 -1
- package/dist/builder-react-lite.cjs.js.map +1 -1
- package/dist/builder-react-lite.esm.js +1 -1
- package/dist/builder-react-lite.esm.js.map +1 -1
- package/dist/builder-react.browser.js +1 -1
- package/dist/builder-react.browser.js.map +1 -1
- package/dist/builder-react.cjs.js +1 -1
- package/dist/builder-react.cjs.js.map +1 -1
- package/dist/builder-react.es5.js +1 -1
- package/dist/builder-react.es5.js.map +1 -1
- package/dist/builder-react.unpkg.js +1 -1
- package/dist/builder-react.unpkg.js.map +1 -1
- package/dist/lib/package.json +1 -1
- package/dist/lib/src/components/builder-block.component.js +3 -0
- package/dist/lib/src/components/builder-block.component.js.map +1 -1
- package/dist/lib/src/components/builder-component.component.js +5 -5
- package/dist/lib/src/components/builder-component.component.js.map +1 -1
- package/dist/lib/test/basic.test.js +31 -0
- package/dist/lib/test/basic.test.js.map +1 -1
- package/dist/lib/test/setupTests.js +8 -0
- package/dist/lib/test/setupTests.js.map +1 -0
- package/dist/types/test/setupTests.d.ts +0 -0
- package/jest.config.js +1 -1
- package/package.json +1 -1
- package/src/components/builder-block.component.tsx +4 -0
- package/src/components/builder-component.component.tsx +10 -10
- package/test/__snapshots__/basic.test.tsx.snap +115 -0
- package/test/__snapshots__/image.test.tsx.snap +18 -10
- package/test/basic.test.tsx +51 -0
- package/test/setupTests.ts +6 -0
package/test/basic.test.tsx
CHANGED
|
@@ -8,6 +8,8 @@ import { render } from '@testing-library/react';
|
|
|
8
8
|
import { Builder, builder } from '@builder.io/sdk';
|
|
9
9
|
import { BuilderPage } from '../src/builder-react';
|
|
10
10
|
import { el, block } from './functions/render-block';
|
|
11
|
+
import * as reactTestRenderer from 'react-test-renderer';
|
|
12
|
+
import { getBuilderPixel } from '../src/functions/get-builder-pixel';
|
|
11
13
|
|
|
12
14
|
builder.init('null');
|
|
13
15
|
|
|
@@ -180,3 +182,52 @@ describe('Content changes when new content provided', () => {
|
|
|
180
182
|
expect(testApi.getByText(textB)).toBeInTheDocument();
|
|
181
183
|
});
|
|
182
184
|
});
|
|
185
|
+
|
|
186
|
+
describe('Builder Pixel', () => {
|
|
187
|
+
it('Should be added automatically if missing in blocksString', () => {
|
|
188
|
+
const renderedBlock = reactTestRenderer.create(
|
|
189
|
+
<BuilderPage
|
|
190
|
+
model="page"
|
|
191
|
+
content={{
|
|
192
|
+
id: 'id',
|
|
193
|
+
data: {
|
|
194
|
+
blocksString: '[]',
|
|
195
|
+
},
|
|
196
|
+
}}
|
|
197
|
+
/>
|
|
198
|
+
);
|
|
199
|
+
expect(renderedBlock).toMatchSnapshot();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('Should be added automatically if missing in blocks array', () => {
|
|
203
|
+
const renderedBlock = reactTestRenderer.create(
|
|
204
|
+
<BuilderPage
|
|
205
|
+
model="page"
|
|
206
|
+
content={{
|
|
207
|
+
id: 'id',
|
|
208
|
+
data: {
|
|
209
|
+
blocks: [],
|
|
210
|
+
},
|
|
211
|
+
}}
|
|
212
|
+
/>
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
expect(renderedBlock).toMatchSnapshot();
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
it('Should not be added if already present in blocks array', () => {
|
|
219
|
+
const renderedBlock = reactTestRenderer.create(
|
|
220
|
+
<BuilderPage
|
|
221
|
+
model="page"
|
|
222
|
+
content={{
|
|
223
|
+
id: 'id',
|
|
224
|
+
data: {
|
|
225
|
+
blocks: [getBuilderPixel('null')],
|
|
226
|
+
},
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
);
|
|
230
|
+
|
|
231
|
+
expect(renderedBlock).toMatchSnapshot();
|
|
232
|
+
});
|
|
233
|
+
});
|