diff --git a/web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt b/web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt index 02fea34042..69f6a3fd9b 100644 --- a/web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt +++ b/web/buildSrc/src/main/kotlin/SeleniumDriverPlugin.kt @@ -4,7 +4,7 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform import java.io.File import java.net.URL -private val CHROME_DRIVER_VERSION = "104.0.5112.79" +private val CHROME_DRIVER_VERSION = "108.0.5359.71" private val GECKO_DRIVER_VERSION = "0.31.0" private fun download(url: String, file: File) { diff --git a/web/compose-compiler-integration/src/jsTest/kotlin/AnonymousObjectsInComposable.kt b/web/compose-compiler-integration/src/jsTest/kotlin/AnonymousObjectsInComposable.kt new file mode 100644 index 0000000000..0bd10d56b0 --- /dev/null +++ b/web/compose-compiler-integration/src/jsTest/kotlin/AnonymousObjectsInComposable.kt @@ -0,0 +1,95 @@ +import androidx.compose.runtime.Composable +import androidx.compose.runtime.remember +import kotlinx.browser.document +import org.jetbrains.compose.web.dom.Div +import org.jetbrains.compose.web.dom.Text +import org.jetbrains.compose.web.renderComposableInBody +import kotlin.test.Test +import kotlin.test.assertEquals + +class AnonymousObjectsInComposable { + + @Test + // Issue: content.Abc$composable_z540rc_k$ is not a function + // https://github.com/JetBrains/compose-jb/issues/2549 + fun testComposableInAnonymousObject() { + renderComposableInBody { + val content: HasComposable2 = createHasComposable() + content.Abc() + } + + assertEquals("
Abc
", document.body!!.firstElementChild!!.outerHTML) + } + + @Test + // Issue: + // java.lang.IllegalArgumentException: Could not find local implementation for Abc$composable + // at androidx.compose.compiler.plugins.kotlin.lower.decoys.DecoyTransformBase$DefaultImpls.getComposableForDecoy(DecoyTransformBase.kt:110) + fun testLocalClassWithComposable() { + renderComposableInBody { + HasLocalClassWithComposable() + } + + assertEquals("
Abc2
", document.body!!.firstElementChild!!.outerHTML) + } + + @Test + // Issue: + // abc3.Abc$composable_z540rc_k$ is not a function + fun testConstructorWithComposable() { + renderComposableInBody { + TestConstructor { return@TestConstructor 111 }.otherComposable!!.invoke() + } + + assertEquals("
Abc223-111
", document.body!!.firstElementChild!!.outerHTML) + } +} + +@Composable +internal fun HasLocalClassWithComposable() { + class Abc : HasComposable2 { + @Composable + override fun Abc() { + Div { Text("Abc2") } + } + } + + val abc = remember { Abc() } + abc.Abc() +} + +@Composable +internal fun createHasComposable(): HasComposable2 { + return object : HasComposable2 { + @Composable + override fun Abc() { + Div { + Text("Abc") + } + } + } +} + +internal interface HasComposable2 { + @Composable + fun Abc() +} + +class TestConstructor constructor() { + + var otherComposable: (@Composable () -> Unit)? = null + constructor(retInt: @Composable () -> Int): this() { + otherComposable = { + val abc3: HasComposable2 = object : HasComposable2 { + @Composable + override fun Abc() { + Div { + val i = retInt() + Text("Abc223-$i") + } + } + } + abc3.Abc() + } + } +} \ No newline at end of file diff --git a/web/gradle.properties b/web/gradle.properties index 0c643431fe..7b6e766fec 100644 --- a/web/gradle.properties +++ b/web/gradle.properties @@ -2,3 +2,4 @@ compose.version=1.3.0-rc05 compose.web.buildSamples=false compose.web.tests.integration.withFirefox compose.web.tests.skip.benchmarks=false +org.gradle.jvmargs=-Xmx8g \ No newline at end of file