From 1e8cbe8afdc2b019d9c285f1b5281b3a42b9c5f6 Mon Sep 17 00:00:00 2001 From: Shagen Ogandzhanian Date: Wed, 14 Jul 2021 20:55:22 +0200 Subject: [PATCH] Add test case for variable in CSS API --- web/core/src/jsTest/kotlin/CSSStylesheetTests.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/core/src/jsTest/kotlin/CSSStylesheetTests.kt b/web/core/src/jsTest/kotlin/CSSStylesheetTests.kt index d263fd408d..07b769e309 100644 --- a/web/core/src/jsTest/kotlin/CSSStylesheetTests.kt +++ b/web/core/src/jsTest/kotlin/CSSStylesheetTests.kt @@ -19,6 +19,8 @@ object AppCSSVariables : CSSVariables { val stringWidth by variable() val stringHeight by variable() + + val order by variable() } object AppStylesheet : StyleSheet() { @@ -35,8 +37,10 @@ object AppStylesheet : StyleSheet() { val classWithRawVariables by style { AppCSSVariables.stringWidth("150px") AppCSSVariables.stringHeight("170px") + AppCSSVariables.order(4) property("width", AppCSSVariables.stringWidth.value()) property("height", AppCSSVariables.stringHeight.value()) + property("order", AppCSSVariables.order.value()) } val classWithTypedVariables by style { @@ -104,7 +108,9 @@ class CSSVariableTests { }) } - val boundingRect = (root.children[1] as HTMLElement).getBoundingClientRect() + val el = root.children[1] as HTMLElement + val boundingRect = el.getBoundingClientRect() + assertEquals("4", window.getComputedStyle(el).order) assertEquals(150.toDouble(), boundingRect.width) assertEquals(170.toDouble(), boundingRect.height) }