diff --git a/web/core/src/jsMain/kotlin/androidx/compose/web/css/properties/background.kt b/web/core/src/jsMain/kotlin/androidx/compose/web/css/properties/background.kt index bffb6c82f1..9a65e7636b 100644 --- a/web/core/src/jsMain/kotlin/androidx/compose/web/css/properties/background.kt +++ b/web/core/src/jsMain/kotlin/androidx/compose/web/css/properties/background.kt @@ -27,6 +27,11 @@ fun StyleBuilder.backgroundImage(value: String) { property("background-image", value) } +// https://developer.mozilla.org/en-US/docs/Web/CSS/background-origin +fun StyleBuilder.backgroundOrigin(value: String) { + property("background-origin", value) +} + // https://developer.mozilla.org/en-US/docs/Web/CSS/background-position fun StyleBuilder.backgroundPosition(value: String) { property("background-position", value) diff --git a/web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt b/web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt index 3f0998bf4a..4acd83090b 100644 --- a/web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt +++ b/web/core/src/jsTest/kotlin/css/CSSBackgroundTests.kt @@ -122,4 +122,25 @@ class CSSBackgroundTests { assertEquals("padding-box", window.getComputedStyle(root.children[1] as HTMLElement).backgroundClip) assertEquals("content-box", window.getComputedStyle(root.children[2] as HTMLElement).backgroundClip) } + + @Test + fun backgroundOrigin() = runTest { + composition { + Div({style { + backgroundOrigin("border-box") + }}) + Div({style { + backgroundOrigin("padding-box") + }}) + Div({style { + backgroundOrigin("content-box") + }}) + } + + + assertEquals("border-box", window.getComputedStyle(root.children[0] as HTMLElement).backgroundOrigin) + assertEquals("padding-box", window.getComputedStyle(root.children[1] as HTMLElement).backgroundOrigin) + assertEquals("content-box", window.getComputedStyle(root.children[2] as HTMLElement).backgroundOrigin) + } + } \ No newline at end of file