-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compose.html: Add visibility property (#2079)
By this PR I am adding opportunity to use visibility property according to the [visibility references](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility)
- Loading branch information
1 parent
f6bf9e6
commit 481bb53
Showing
4 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
html/core/src/jsMain/kotlin/org/jetbrains/compose/web/css/properties/visibility.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright 2020-2024 JetBrains s.r.o. and respective authors and developers. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
@file:Suppress("Unused", "NOTHING_TO_INLINE", "NESTED_CLASS_IN_EXTERNAL_INTERFACE", "INLINE_EXTERNAL_DECLARATION", "WRONG_BODY_OF_EXTERNAL_DECLARATION", "NESTED_EXTERNAL_DECLARATION") | ||
|
||
package org.jetbrains.compose.web.css | ||
|
||
fun StyleScope.visibility(visibilityStyle: VisibilityStyle) { | ||
property("visibility", visibilityStyle.value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Copyright 2020-2021 JetBrains s.r.o. and respective authors and developers. | ||
* Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE.txt file. | ||
*/ | ||
|
||
package org.jetbrains.compose.web.core.tests.css | ||
|
||
import org.jetbrains.compose.web.testutils.* | ||
import org.jetbrains.compose.web.core.tests.values | ||
import org.jetbrains.compose.web.css.VisibilityStyle | ||
import org.jetbrains.compose.web.css.visibility | ||
import org.jetbrains.compose.web.css.value | ||
import org.jetbrains.compose.web.dom.Div | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
|
||
class CSSVisibilityTests { | ||
|
||
@Test | ||
fun stylesDisplay() = runTest { | ||
val enumValues = VisibilityStyle.values() | ||
|
||
composition { | ||
enumValues.forEach { displayStyle -> | ||
Div( | ||
{ | ||
style { | ||
visibility(displayStyle) | ||
} | ||
} | ||
) | ||
} | ||
} | ||
|
||
enumValues.forEach { visibilityStyle -> | ||
assertEquals( | ||
visibilityStyle.value, | ||
(nextChild()).style.visibility | ||
) | ||
} | ||
} | ||
|
||
} |