Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Avoids converting a gif into a function (#247)
- Loading branch information
1 parent
e27ea76
commit b76a50a
Showing
6 changed files
with
109 additions
and
10 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
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,4 @@ | ||
(function () { | ||
const element = document.querySelector("#javascript-execution") | ||
element.textContent = "Executed the js" | ||
})() |
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,60 @@ | ||
<!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>Javascript request execution 🎉</title> | ||
|
||
<script> | ||
partytown = { | ||
logCalls: true, | ||
logGetters: true, | ||
logSetters: true, | ||
logImageRequests: true, | ||
logMainAccess: true, | ||
logSendBeaconRequests: true, | ||
logStackTraces: false, | ||
logScriptExecution: true, | ||
} | ||
</script> | ||
<script src="/~partytown/debug/partytown.js"></script> | ||
</head> | ||
<body> | ||
<h1>Javascript request execution</h1> | ||
|
||
<p> | ||
<strong>Javascript ("create-element.js") execution</strong> | ||
<span id="javascript-execution"></span> | ||
</p> | ||
|
||
<p> | ||
<strong>Text ("some-text.txt") execution</strong> | ||
<span id="text-execution"></span> | ||
</p> | ||
|
||
<!-- Some third party js --> | ||
<script type="text/partytown"> | ||
(async function(){ | ||
const jsRequestElement = document.createElement("script") | ||
jsRequestElement.setAttribute("src", "/tests/integrations/javascript-request/execute.js") | ||
document.head.appendChild(jsRequestElement) | ||
|
||
const textRequestElement = document.createElement("script") | ||
textRequestElement.setAttribute("src", "/tests/integrations/javascript-request/some-text.txt") | ||
document.head.appendChild(textRequestElement) | ||
|
||
})() | ||
</script> | ||
<!-- End Some third party js --> | ||
|
||
<script type="text/partytown"> | ||
(function () { | ||
document.body.classList.add('completed') | ||
})() | ||
</script> | ||
|
||
<p><a href="/tests/">All Tests</a></p> | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
tests/integrations/javascript-request/javascript-request.spec.ts
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,19 @@ | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test('javascript request execution', async ({ page }) => { | ||
await page.goto('/tests/integrations/javascript-request/'); | ||
|
||
await page.waitForSelector('.completed'); | ||
|
||
const javascriptExecutionElement = page.locator('#javascript-execution'); | ||
await expect(javascriptExecutionElement).toHaveText('Executed the js'); | ||
}); | ||
|
||
test('text request execution', async ({ page }) => { | ||
await page.goto('/tests/integrations/javascript-request/'); | ||
|
||
await page.waitForSelector('.completed'); | ||
|
||
const textExecutionElement = page.locator('#text-execution'); | ||
await expect(textExecutionElement).toBeEmpty(); | ||
}); |
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,4 @@ | ||
(function () { | ||
const element = document.querySelector("#text-execution") | ||
element.textContent = "Executed the text" | ||
})() |
b76a50a
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:
partytown – ./
partytown.vercel.app
partytown-builder-io.vercel.app
partytown.builder.io
partytown-git-main-builder-io.vercel.app