feat(ct): vue2 throw when updating a native html element (#22407)

Related to: https://github.com/microsoft/playwright/issues/22328.
This commit is contained in:
Sander 2023-04-19 16:28:21 +02:00 committed by GitHub
parent b3b624b0c9
commit 060979ef86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -190,6 +190,9 @@ window.playwrightUpdate = async (element, options) => {
throw new Error('Component was not mounted');
const component = wrapper.componentInstance;
if (!component)
throw new Error('Updating a native HTML element is not supported');
const { nodeData, slots } = __pwCreateComponent(options);
for (const [name, value] of Object.entries(nodeData.on || {})) {

View File

@ -43,3 +43,11 @@ test('update slots without remounting', async ({ mount }) => {
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');
});