mirror of https://github.com/sveltejs/svelte
Merge pull request #735 from sveltejs/gh-643
don't throw error if component is destroyed twicepull/746/head
commit
f7738fe42d
@ -0,0 +1,6 @@
|
|||||||
|
export default {
|
||||||
|
test(assert, component) {
|
||||||
|
component.destroy();
|
||||||
|
component.destroy();
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
<div/>
|
@ -0,0 +1,21 @@
|
|||||||
|
export default {
|
||||||
|
dev: true,
|
||||||
|
|
||||||
|
test(assert, component) {
|
||||||
|
const warn = console.warn; // eslint-disable-line no-console
|
||||||
|
|
||||||
|
const warnings = [];
|
||||||
|
console.warn = warning => { // eslint-disable-line no-console
|
||||||
|
warnings.push(warning);
|
||||||
|
};
|
||||||
|
|
||||||
|
component.destroy();
|
||||||
|
component.destroy();
|
||||||
|
|
||||||
|
assert.deepEqual(warnings, [
|
||||||
|
`Component was already destroyed`
|
||||||
|
]);
|
||||||
|
|
||||||
|
console.warn = warn; // eslint-disable-line no-console
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1 @@
|
|||||||
|
<div/>
|
Loading…
Reference in new issue