Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 987fcbf

Browse files
Remove innerHTML check and rely on types instead. Also remove null as a valid type.
1 parent 568a330 commit 987fcbf

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

‎src/__tests__/screen.js‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ test('logs messsage when element is not a valid HTML', () => {
4646
expect(console.log.mock.calls[0][0]).toMatchInlineSnapshot(
4747
`"The element you're providing isn't a valid DOM element."`,
4848
)
49-
console.log.mockClear()
50-
screen.logTestingPlaygroundURL({})
51-
expect(console.log).toHaveBeenCalledTimes(1)
52-
expect(console.log.mock.calls[0][0]).toMatchInlineSnapshot(
53-
`"The element you're providing isn't a valid DOM element."`,
54-
)
5549
})
5650

5751
test('logs Playground URL that are passed as element', () => {

‎src/playground-helper.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ function encode(value: string) {
1010
return compressToEncodedURIComponent(unindent(value))
1111
}
1212

13-
function getPlaygroundUrl(element: Element | null) {
14-
if (!element || !('innerHTML' in element)) {
13+
function getPlaygroundUrl(element: Element) {
14+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
15+
if (!element) {
1516
throw new Error(`The element you're providing isn't a valid DOM element.`)
1617
}
1718

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /