Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
container
);
expect(container.innerHTML).toBe(SFCHtml + FragmentAHtml + SFCHtml + FragmentCHtml + SFCHtml);
// Switch order again
render(
createElement(
Fragment,
null,
createElement('div', { key: '1' }, '1'),
createElement(SFC, { key: 'sfc1' }),
createElement(SFC, { key: 'sfc2' }),
fragmentA,
fragmentC,
createElement('div', { key: '1' }, '2'),
createElement(SFC, { key: 'sfc3' })
),
container
);
// Verify dom has changed and nodes are the same
expect(container.innerHTML).toBe('<div>1</div>' + SFCHtml + SFCHtml + FragmentAHtml + FragmentCHtml + '<div>2</div>' + SFCHtml);
render(null, container);
expect(container.innerHTML).toBe('');
});
it('Should append DOM nodes to correct position when component root Fragmnet change', () => {
let TestRoot = class TestRoot extends Component {
render() {
return createElement(Fragment, null, this.props.children);
}
};
render(
createElement(
'div',
null,
createElement(TestRoot, null, createElement('div', null, '1'), createElement('div', null, '2')),
createElement(TestRoot, null, createElement('span', null, 'Ok'), createElement('span', null, 'Test'))
),
container
);
expect(container.innerHTML).toBe('<div><div>1</div><div>2</div><span>Ok</span><span>Test</span></div>');
render(
createElement(
'div',
null,
createElement(
TestRoot,
null,
createElement('div', null, '1'),
createElement('div', null, '2'),
createElement('div', null, '3'),
it('works', () => {
const A = [];
A[0] = createElement('div', null, 'text 1', createElement('br', null));
A[1] = createElement('div', null, 'text 2');
A[2] = createElement('div', null, createElement('br', null), 'text 4');
render(A[0], container);
expect(container.innerHTML).toBe(innerHTML('<div>text 1<br></div>'));
render(A[1], container);
expect(container.innerHTML).toBe(innerHTML('<div>text 2</div>'));
render(A[2], container);
expect(container.innerHTML).toBe(innerHTML('<div><br>text 4</div>'));
});
});
expect(container.innerHTML).toBe('<div>2a2b2c1a1b</div>');
expect(unmountCounter).toBe(0);
expect(mountCounter).toBe(5);
render(
createElement(
'div',
null,
createElement(
Fragment,
{ key: '3' },
createElement(TestLifecycle, null, '3a'),
createElement(TestLifecycle, null, '3b'),
createElement(TestLifecycle, null, '3c')
),
createElement(Fragment, { key: '2' }, createElement(TestLifecycle, null, '2a'), createElement(TestLifecycle, null, '2Patched'))
),
container
);
expect(container.innerHTML).toBe('<div>3a3b3c2a2Patched</div>');
expect(unmountCounter).toBe(3);
expect(mountCounter).toBe(8);
});
function C() {
return createElement(
'div',
null,
createElement('div', null, createElement('table', null, createElement('tr', { key: 'row1' }, createElement('td', { key: 'td1' }, 'text1'))))
);
}
child = () =>
createElement(
'circle',
{
xmlns: 'http://www.w3.org/2000/svg'
},
createElement('circle', {
xmlns: 'http://www.w3.org/2000/svg'
})
);
const template = function(val1, val2, val3, val4, val5, val6) {
return createElement(
'div',
{
className: val2,
id: val1
},
createElement(
'div',
{
id: val5
},
createElement('span', null, val6)
),
createElement(
'div',
{
className: val4
},
val3
)
);
};
Object.assign(attributes, {
className: classes,
role: 'alert'
})
const childEls = [
onClose ?
<button aria-label="Close" type="button">
<span aria-hidden="true">×</span>
</button>
: null,
children
]
return createElement(
Tag,
attributes,
childEls
)
};
const ModalFooter = (props) => {
const {
children,
className,
cssModule,
tag: Tag,
...attributes } = props;
const classes = mapToCssModules(classNames(
className,
'modal-footer'
), cssModule);
Object.assign(attributes, { className: classes })
return createElement(
Tag,
attributes,
children
)
};