forked from sveltejs/svelte
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: document fullscreenElement and visibilityState bindings (svelte…
- Loading branch information
1 parent
a74caf1
commit c4261ab
Showing
7 changed files
with
149 additions
and
3 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
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
31 changes: 31 additions & 0 deletions
31
test/runtime/samples/document-binding-fullscreen/_config.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,31 @@ | ||
export default { | ||
before_test() { | ||
Object.defineProperties(window.document, { | ||
fullscreenElement: { | ||
value: null, | ||
configurable: true | ||
} | ||
}); | ||
}, | ||
|
||
// copied from window-binding | ||
// there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason | ||
skip_if_ssr: true, | ||
|
||
async test({ assert, target, window, component }) { | ||
const event = new window.Event('fullscreenchange'); | ||
|
||
const div = target.querySelector('div'); | ||
|
||
Object.defineProperties(window.document, { | ||
fullscreenElement: { | ||
value: div, | ||
configurable: true | ||
} | ||
}); | ||
|
||
window.document.dispatchEvent(event); | ||
|
||
assert.equal(component.fullscreen, div); | ||
} | ||
}; |
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,7 @@ | ||
<script> | ||
export let fullscreen; | ||
</script> | ||
|
||
<svelte:document bind:fullscreenElement={fullscreen}/> | ||
|
||
<div /> |