fix(blocksBasic): Html test change to new RenderHtml.

This commit is contained in:
Gervwyk 2021-08-23 10:12:26 +02:00
parent 9351255d3a
commit e43617a47a
3 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,13 @@ import React from 'react';
import { blockDefaultProps, RenderHtml } from '@lowdefy/block-tools';
const HtmlBlock = ({ blockId, properties, methods }) => (
<RenderHtml id={blockId} html={properties.html} methods={methods} style={properties.style} />
<RenderHtml
div={true}
html={properties.html}
id={blockId}
methods={methods}
style={properties.style}
/>
);
HtmlBlock.defaultProps = blockDefaultProps;

View File

@ -57,11 +57,11 @@ test('update on properties.html change', () => {
);
const wrapper = mount(<Shell properties={config.properties} />);
expect(wrapper.html()).toMatchInlineSnapshot(
`"<div id=\\"update\\" data-testid=\\"update\\" class=\\"{&quot;style&quot;:[{&quot;display&quot;:&quot;inline-block&quot;},null]}\\"><div>one</div></div>"`
`"<div id=\\"update\\" data-testid=\\"update\\" class=\\"{}\\"><div>one</div></div>"`
);
wrapper.setProps({ properties: { html: '<div>two</div>' } });
wrapper.update();
expect(wrapper.html()).toMatchInlineSnapshot(
`"<div id=\\"update\\" data-testid=\\"update\\" class=\\"{&quot;style&quot;:[{&quot;display&quot;:&quot;inline-block&quot;},null]}\\"><div>two</div></div>"`
`"<div id=\\"update\\" data-testid=\\"update\\" class=\\"{}\\"><div>two</div></div>"`
);
});

View File

@ -1,16 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Render default - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},null]}"
data-testid="default"
id="default"
/>
`;
exports[`Render default - value[0] 1`] = `""`;
exports[`Render properties.html - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},null]}"
className="{}"
data-testid="properties.html"
id="properties.html"
/>
@ -18,7 +12,7 @@ exports[`Render properties.html - value[0] 1`] = `
exports[`Render properties.html-bad-code - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},null]}"
className="{}"
data-testid="properties.html-bad-code"
id="properties.html-bad-code"
/>
@ -26,7 +20,7 @@ exports[`Render properties.html-bad-code - value[0] 1`] = `
exports[`Render properties.html-iframe - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},null]}"
className="{}"
data-testid="properties.html-iframe"
id="properties.html-iframe"
/>
@ -34,7 +28,7 @@ exports[`Render properties.html-iframe - value[0] 1`] = `
exports[`Render properties.html-styled - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},{\\"background\\":\\"yellow\\",\\"padding\\":10}]}"
className="{\\"style\\":{\\"background\\":\\"yellow\\",\\"padding\\":10}}"
data-testid="properties.html-styled"
id="properties.html-styled"
/>
@ -42,7 +36,7 @@ exports[`Render properties.html-styled - value[0] 1`] = `
exports[`Render properties.style - value[0] 1`] = `
<div
className="{\\"style\\":[{\\"display\\":\\"inline-block\\"},{\\"background\\":\\"yellow\\",\\"padding\\":10}]}"
className="{\\"style\\":{\\"background\\":\\"yellow\\",\\"padding\\":10}}"
data-testid="properties.style"
id="properties.style"
/>