Browse Source

backgroundColor accepts only color signature

891_NO_COLOR_STRING_SIGNATURES
Shagen Ogandzhanian 3 years ago
parent
commit
80e227d627
  1. 4
      web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/background.kt
  2. 4
      web/core/src/jsTest/kotlin/CSSStylesheetTests.kt
  3. 4
      web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt
  4. 2
      web/core/src/jsTest/kotlin/elements/AttributesTests.kt

4
web/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/background.kt

@ -14,10 +14,6 @@ fun StyleBuilder.backgroundClip(value: String) {
property("background-clip", value) property("background-clip", value)
} }
fun StyleBuilder.backgroundColor(value: String) {
property("background-color", value)
}
fun StyleBuilder.backgroundColor(value: CSSColorValue) { fun StyleBuilder.backgroundColor(value: CSSColorValue) {
property("background-color", value) property("background-color", value)
} }

4
web/core/src/jsTest/kotlin/CSSStylesheetTests.kt

@ -52,7 +52,7 @@ object AppStylesheet : StyleSheet() {
val withMedia by style { val withMedia by style {
color("lime") color("lime")
backgroundColor("lime") backgroundColor(Color.lime)
media(mediaMinWidth(20000.px)) { media(mediaMinWidth(20000.px)) {
self style { self style {
@ -62,7 +62,7 @@ object AppStylesheet : StyleSheet() {
media(mediaMinWidth(20.px)) { media(mediaMinWidth(20.px)) {
self style { self style {
backgroundColor("green") backgroundColor(Color.green)
} }
} }

4
web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt

@ -19,10 +19,10 @@ class CSSBackgroundTests {
fun backgroundColor() = runTest { fun backgroundColor() = runTest {
composition { composition {
Div({style { Div({style {
backgroundColor("rgb(0, 128, 0)") backgroundColor(rgb(0, 128, 0))
}}) }})
Div({style { Div({style {
backgroundColor("rgba(0, 129, 0, 0.2)") backgroundColor(rgba(0, 129, 0, 0.2))
}}) }})
} }

2
web/core/src/jsTest/kotlin/elements/AttributesTests.kt

@ -48,7 +48,7 @@ class AttributesTests {
ref { onDispose { } } ref { onDispose { } }
style { style {
width(500.px) width(500.px)
backgroundColor("red") backgroundColor(Color.red)
} }
onClick { } onClick { }

Loading…
Cancel
Save