-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from lino-levan/feat-innertext
feat: ElementHandle.innerText/HTML
- Loading branch information
Showing
3 changed files
with
81 additions
and
1 deletion.
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,18 @@ | ||
export const snapshot = {}; | ||
|
||
snapshot[`Testing evaluate 1`] = ` | ||
' | ||
<h1>Example Domain</h1> | ||
<p>This domain is for use in illustrative examples in documents. You may use this | ||
domain in literature without prior coordination or asking for permission.</p> | ||
<p><a href="https://www.iana.org/domains/example">More information...</a></p> | ||
' | ||
`; | ||
|
||
snapshot[`Testing evaluate 2`] = ` | ||
"Example Domain | ||
This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission. | ||
More information..." | ||
`; |
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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
import { assertEquals } from "https://deno.land/[email protected]/assert/assert_equals.ts"; | ||
import { assertSnapshot } from "https://deno.land/[email protected]/testing/snapshot.ts"; | ||
|
||
import { launch } from "../mod.ts"; | ||
|
||
Deno.test("Testing evaluate", async () => { | ||
Deno.test("Testing evaluate", async (t) => { | ||
// Launch browser | ||
const browser = await launch(); | ||
|
||
|
@@ -17,6 +18,11 @@ Deno.test("Testing evaluate", async () => { | |
}); | ||
assertEquals(result, "stringconcat"); | ||
|
||
// innerHTML / innerText | ||
const element = (await page.$("div"))!; | ||
assertSnapshot(t, await element.innerHTML()); | ||
assertSnapshot(t, await element.innerText()); | ||
|
||
// Close browser | ||
await browser.close(); | ||
}); |