-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: migrate file-delete-restore playground test to hmr playground (#…
- Loading branch information
1 parent
509201b
commit 401647f
Showing
14 changed files
with
109 additions
and
192 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
60 changes: 0 additions & 60 deletions
60
playground/file-delete-restore/__tests__/file-delete-restore.spec.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
import { rerender } from './runtime' | ||
|
||
export const value = 'child' | ||
|
||
if (import.meta.hot) { | ||
import.meta.hot.accept((newMod) => { | ||
if (!newMod) return | ||
|
||
rerender({ child: newMod.value }) | ||
}) | ||
} |
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,4 @@ | ||
import { render } from './runtime' | ||
import { childValue, parentValue } from './parent' | ||
|
||
render({ parent: parentValue, child: childValue }) |
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,12 @@ | ||
import { rerender } from './runtime' | ||
|
||
export const parentValue = 'parent' | ||
export { value as childValue } from './child' | ||
|
||
if (import.meta.hot) { | ||
import.meta.hot.accept((newMod) => { | ||
if (!newMod) return | ||
|
||
rerender({ child: newMod.childValue, parent: newMod.parentValue }) | ||
}) | ||
} |
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,16 @@ | ||
let state = {} | ||
|
||
export const render = (newState) => { | ||
state = newState | ||
apply() | ||
} | ||
|
||
export const rerender = (updates) => { | ||
state = { ...state, ...updates } | ||
apply() | ||
} | ||
|
||
const apply = () => { | ||
document.querySelector('.file-delete-restore').textContent = | ||
Object.values(state).join(':') | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.