-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce VM feature "enableComponentSrcDataKey" as a config option (#38
) * Add hot reload * Fix enableHotReload test * Fix tests * Fix tests * Refactor * Revert style changes * Fix socket address * Fix ws address test structure WIP: websocket test WIP: hot realod websocket test Remove test * update docs * adds tests * adds component * WIP: working test on port 3001 * Fix test, not time dependend now * Move hotReload to config * Single param for hotReload * adds config object * clean up * fix readme * formatting * formatting * Failing test * Working test * Fixing tests * Fix test * Update readme --------- Co-authored-by: Elliot Braem <16282460+elliotBraem@users.noreply.github.com>
- Loading branch information
1 parent
f16abfb
commit fd97cee
Showing
6 changed files
with
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { describe, expect, test } from "@playwright/test"; | ||
import { waitForSelectorToBeVisible } from "../testUtils"; | ||
|
||
async function setupNearSocialViewer(page, src, config) { | ||
await page.evaluate( | ||
({ src, config }) => { | ||
document.body.innerHTML = `<near-social-viewer src="${src}" config='${JSON.stringify(config)}'></near-social-viewer>`; | ||
}, | ||
{ src, config } | ||
); | ||
} | ||
|
||
describe("test data-component attribute", () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto("/"); | ||
}); | ||
|
||
test("by default there will be no data-component attribute", async ({ | ||
page, | ||
}) => { | ||
await page.evaluate(() => { | ||
const src = "zavodil.near/widget/Lido"; | ||
|
||
document.body.innerHTML = `<near-social-viewer src="${src}"></near-social-viewer>`; | ||
}); | ||
|
||
const dataComponentElements = page.locator("div[data-component]"); | ||
await expect(dataComponentElements).toHaveCount(0); | ||
}); | ||
|
||
test("with the correct configuration there will be a data-component property in the components", async ({ | ||
page, | ||
}) => { | ||
const src = "zavodil.near/widget/Lido"; | ||
const config = { "vm": { "features": {"enableComponentSrcDataKey": true }}} | ||
|
||
await setupNearSocialViewer(page, src, config); | ||
|
||
await waitForSelectorToBeVisible(page, "div[data-component]"); | ||
const dataComponentValue = await page.getAttribute( | ||
"div[data-component]", | ||
"data-component" | ||
); | ||
|
||
expect(dataComponentValue).toBe(src); | ||
}); | ||
}); |
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
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