From 6032f005ea726092543f3319e64dab46c23ec71a Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Tue, 11 Jan 2022 17:52:04 +0100 Subject: [PATCH] Update test with multiple onDispose calls --- .../src/jsTest/kotlin/DomSideEffectTests.kt | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/web/core/src/jsTest/kotlin/DomSideEffectTests.kt b/web/core/src/jsTest/kotlin/DomSideEffectTests.kt index b0ff1f1c0a..2d937ffd6c 100644 --- a/web/core/src/jsTest/kotlin/DomSideEffectTests.kt +++ b/web/core/src/jsTest/kotlin/DomSideEffectTests.kt @@ -119,9 +119,31 @@ class DomSideEffectTests { Div { DomSideEffect(key) { effectsList.add("DomSideEffect") + + onDispose { + effectsList.add("DomSideEffectIgnored") + } + + onDispose { + throw Exception("this should be ignored") + } + + onDispose { + effectsList.add("DomSideEffectDisposed") + } + } DisposableRefEffect(key) { effectsList.add("DisposableRefEffect") + + onDispose { + effectsList.add("DisposableRefEffectIgnored") + } + + onDispose { + throw Exception("this should be ignored") + } + onDispose { effectsList.add("DisposableRefEffectDisposed") } @@ -140,7 +162,14 @@ class DomSideEffectTests { waitForRecompositionComplete() assertContentEquals( - listOf("DisposableRefEffect", "DomSideEffect", "DisposableRefEffectDisposed", "DisposableRefEffect", "DomSideEffect"), + listOf( + "DisposableRefEffect", + "DomSideEffect", + "DisposableRefEffectDisposed", + "DomSideEffectDisposed", + "DisposableRefEffect", + "DomSideEffect" + ), effectsList ) }