Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue-174 - createEnvironment in createHTMLDocument #177

Merged
merged 1 commit into from Jun 1, 2022

Conversation

quickshiftin
Copy link
Contributor

This seems to resolve Issue #174 by ensuring the window object created in WorkerDocument.implementation.createHTMLDocument is registered with the environments so that subsequent calls to createElement on the document it returns are properly found by getOrCreateNodeInstance.

I've also updated the unit tests. Note these tests fail on the current main branch.

@vercel
Copy link

vercel bot commented May 11, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
partytown ✅ Ready (Inspect) Visit Preview May 11, 2022 at 3:36PM (UTC)

@quickshiftin
Copy link
Contributor Author

@adamdbradley would you be able to review this? I've added a test which breaks under current code and is resolved with the patch.

@adamdbradley
Copy link
Contributor

Looks good, but would you also be able to add to the tests that replicates this issue? #174 (comment) Thanks

@@ -92,7 +92,7 @@ test('document', async ({ page }) => {
await expect(testCreateElementError_).toHaveText('no error');

const testCreateHTMLDocument = page.locator('#testCreateHTMLDocument');
await expect(testCreateHTMLDocument).toHaveText('88mph hidden');
await expect(testCreateHTMLDocument).toHaveText('88mph hidden object');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamdbradley this is where I added the test from #174 Comment

const addlElm = doc.createElement('base');
const addlElmType = typeof addlElm;

doc.body.textContent = '88mph ' + doc.visibilityState + ' ' + addlElmType;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adamdbradley this is where I added the test from #174 Comment

@quickshiftin
Copy link
Contributor Author

@adamdbradley I added the test case, to the existing createHTMLDocument test (referenced above). If there's a more appropriate place to do it, or I've missed something in the test, I'm happy to revise. Could you point me in the right direction if that's the case?

@adamdbradley adamdbradley merged commit 9c0ef6f into BuilderIO:main Jun 1, 2022
@adamdbradley
Copy link
Contributor

Thanks for the PR. I'll take a look into adding another test too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants