-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
094c070
commit 9c00b4d
Showing
5 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { definePrototypePropertyDescriptor } from '../utils'; | ||
import type { WorkerNode } from '../types'; | ||
import { cachedProps } from './worker-constructors'; | ||
|
||
export const patchHTMLFormElement = (WorkerHTMLFormElement: any) => { | ||
const HTMLFormDescriptorMap: PropertyDescriptorMap & ThisType<WorkerNode> = {}; | ||
|
||
definePrototypePropertyDescriptor(WorkerHTMLFormElement, HTMLFormDescriptorMap); | ||
cachedProps(WorkerHTMLFormElement, 'elements'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('form', async ({ page }) => { | ||
await page.goto('/tests/platform/form/'); | ||
|
||
await page.waitForSelector('.completed'); | ||
|
||
const testFormMethod = page.locator('#testFormMethod'); | ||
await expect(testFormMethod).toHaveText('get'); | ||
|
||
const testFormElements = page.locator('#testFormElements'); | ||
await expect(testFormElements).toHaveText('1'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<meta name="description" content="Partytown Test Page" /> | ||
<title>Form</title> | ||
<style> | ||
body { | ||
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, | ||
Apple Color Emoji, Segoe UI Emoji; | ||
font-size: 12px; | ||
} | ||
h1 { | ||
margin: 0 0 15px 0; | ||
} | ||
ul { | ||
list-style-type: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
a { | ||
display: block; | ||
padding: 16px 8px; | ||
} | ||
a:link, | ||
a:visited { | ||
text-decoration: none; | ||
color: blue; | ||
} | ||
a:hover { | ||
background-color: #eee; | ||
} | ||
li { | ||
display: flex; | ||
margin: 15px 0; | ||
} | ||
li strong, | ||
li code, | ||
li button { | ||
white-space: nowrap; | ||
flex: 1; | ||
margin: 0 5px; | ||
} | ||
</style> | ||
<script> | ||
partytown = { | ||
logCalls: true, | ||
logGetters: true, | ||
logSetters: true, | ||
logStackTraces: false, | ||
logScriptExecution: true, | ||
}; | ||
</script> | ||
<script src="/~partytown/debug/partytown.js"></script> | ||
</head> | ||
<body> | ||
<h1>Form</h1> | ||
<ul> | ||
<li> | ||
<strong>form, method</strong> | ||
<code id="testFormMethod"></code> | ||
<script type="text/partytown"> | ||
(function () { | ||
const form = document.createElement('form'); | ||
document.getElementById('testFormMethod').textContent = form.method; | ||
})(); | ||
</script> | ||
</li> | ||
|
||
<li> | ||
<strong>form, elements</strong> | ||
<code id="testFormElements"></code> | ||
<script type="text/partytown"> | ||
(function () { | ||
const form = document.createElement('form'); | ||
const input = document.createElement('input'); | ||
form.appendChild(input); | ||
document.getElementById('testFormElements').textContent = form.elements.length; | ||
})(); | ||
</script> | ||
</li> | ||
|
||
<script type="text/partytown"> | ||
(function () { | ||
document.body.classList.add('completed'); | ||
})(); | ||
</script> | ||
</ul> | ||
|
||
<hr /> | ||
<p><a href="/tests/">All Tests</a></p> | ||
</body> | ||
</html> |
9c00b4d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: