feat(ct): vue throw when updating a native html element (#22392)
Related to: https://github.com/microsoft/playwright/issues/22328.
This commit is contained in:
parent
49c9284bc7
commit
b3b624b0c9
|
|
@ -253,6 +253,9 @@ window.playwrightUpdate = async (rootElement, options) => {
|
||||||
if (!wrapper)
|
if (!wrapper)
|
||||||
throw new Error('Component was not mounted');
|
throw new Error('Component was not mounted');
|
||||||
|
|
||||||
|
if (!wrapper.component)
|
||||||
|
throw new Error('Updating a native HTML element is not supported');
|
||||||
|
|
||||||
const { slots, listeners, props } = __pwCreateComponent(options);
|
const { slots, listeners, props } = __pwCreateComponent(options);
|
||||||
|
|
||||||
wrapper.component.slots = __pwWrapFunctions(slots);
|
wrapper.component.slots = __pwWrapFunctions(slots);
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,11 @@ test('renderer and keep the component instance intact', async ({ mount }) => {
|
||||||
|
|
||||||
await expect(component.getByTestId('remount-count')).toContainText('1');
|
await expect(component.getByTestId('remount-count')).toContainText('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('throw error when updating a native html element', async ({ mount }) => {
|
||||||
|
const component = await mount(<div id="1337"></div>);
|
||||||
|
|
||||||
|
await expect(async () => {
|
||||||
|
await component.update(<div id="9001"></div>);
|
||||||
|
}).rejects.toThrowError('Updating a native HTML element is not supported');
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -43,3 +43,11 @@ test('update slots without remounting', async ({ mount }) => {
|
||||||
|
|
||||||
await expect(component.getByTestId('remount-count')).toContainText('1');
|
await expect(component.getByTestId('remount-count')).toContainText('1');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('throw error when updating a native html element', async ({ mount }) => {
|
||||||
|
const component = await mount(<div id="1337"></div>);
|
||||||
|
|
||||||
|
await expect(async () => {
|
||||||
|
await component.update(<div id="9001"></div>);
|
||||||
|
}).rejects.toThrowError('Updating a native HTML element is not supported');
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue