Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Support for overflow, overflow-x and overflow-y #1

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ const val ORDER = "order"
const val OBJECT_FIT = "object-fit"
const val OBJECT_POSITION = "object-position"
const val OPACITY = "opacity"
const val OVERFLOW = "overflow"
const val OVERFLOW_X = "overflow-x"
const val OVERFLOW_Y = "overflow-y"

const val PADDING = "padding"
const val PADDING_LEFT = "padding-left"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package io.github.allangomes.kotlinwind.css.features

import io.github.allangomes.kotlinwind.css.api.KWScope
import io.github.allangomes.kotlinwind.css.core.OVERFLOW
import io.github.allangomes.kotlinwind.css.core.OVERFLOW_X
import io.github.allangomes.kotlinwind.css.core.OVERFLOW_Y
import io.github.allangomes.kotlinwind.css.core.StyleValueMarker

@Suppress("PropertyName")
interface Overflow<T> : KWScope<T> {

/** overflow: auto; */
@StyleValueMarker
val overflow_auto get() = OVERFLOW value "auto"

/** overflow: hidden; */
@StyleValueMarker
val overflow_hidden get() = OVERFLOW value "hidden"

/** overflow: clip; */
@StyleValueMarker
val overflow_clip get() = OVERFLOW value "clip"

/** overflow: visible; */
@StyleValueMarker
val overflow_visible get() = OVERFLOW value "visible"

/** overflow: scroll; */
@StyleValueMarker
val overflow_scroll get() = OVERFLOW value "scroll"

/** overflow-x: auto; */
@StyleValueMarker
val overflow_x_auto get() = OVERFLOW_X value "auto"

/** overflow-x: hidden; */
@StyleValueMarker
val overflow_x_hidden get() = OVERFLOW_X value "hidden"

/** overflow-x: clip; */
@StyleValueMarker
val overflow_x_clip get() = OVERFLOW_X value "clip"

/** overflow-x: visible; */
@StyleValueMarker
val overflow_x_visible get() = OVERFLOW_X value "visible"

/** overflow-x: scroll; */
@StyleValueMarker
val overflow_x_scroll get() = OVERFLOW_X value "scroll"

/** overflow-y: auto; */
@StyleValueMarker
val overflow_y_auto get() = OVERFLOW_Y value "auto"

/** overflow-y: hidden; */
@StyleValueMarker
val overflow_y_hidden get() = OVERFLOW_Y value "hidden"

/** overflow-y: clip; */
@StyleValueMarker
val overflow_y_clip get() = OVERFLOW_Y value "clip"

/** overflow-y: visible; */
@StyleValueMarker
val overflow_y_visible get() = OVERFLOW_Y value "visible"

/** overflow-y: scroll; */
@StyleValueMarker
val overflow_y_scroll get() = OVERFLOW_Y value "scroll"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Root : KWRoot,
ObjectFit<Root>,
ObjectPosition<Root>,
Opacity<Root>,
Overflow<Root>,
Position<Root>,
PositionBottom<Root>,
PositionInset<Root>,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
package io.github.allangomes.kotlinwind.css.features

import io.github.allangomes.kotlinwind.css.KW
import io.github.allangomes.kotlinwind.css.api.Style
import io.github.allangomes.kotlinwind.css.core.OVERFLOW
import io.github.allangomes.kotlinwind.css.core.OVERFLOW_X
import io.github.allangomes.kotlinwind.css.core.OVERFLOW_Y
import kotlin.test.Test
import kotlin.test.assertEquals

class OverflowTest {

@Test
fun overflow_auto() {
val expected = Style(OVERFLOW, "auto").toString()
val actual = KW.inline { overflow_auto }
assertEquals(expected, actual)
}

@Test
fun overflow_hidden() {
val expected = Style(OVERFLOW, "hidden").toString()
val actual = KW.inline { overflow_hidden }
assertEquals(expected, actual)
}

@Test
fun overflow_clip() {
val expected = Style(OVERFLOW, "clip").toString()
val actual = KW.inline { overflow_clip }
assertEquals(expected, actual)
}

@Test
fun overflow_visible() {
val expected = Style(OVERFLOW, "visible").toString()
val actual = KW.inline { overflow_visible }
assertEquals(expected, actual)
}

@Test
fun overflow_scroll() {
val expected = Style(OVERFLOW, "scroll").toString()
val actual = KW.inline { overflow_scroll }
assertEquals(expected, actual)
}

@Test
fun overflow_x_auto() {
val expected = Style(OVERFLOW_X, "auto").toString()
val actual = KW.inline { overflow_x_auto }
assertEquals(expected, actual)
}

@Test
fun overflow_x_hidden() {
val expected = Style(OVERFLOW_X, "hidden").toString()
val actual = KW.inline { overflow_x_hidden }
assertEquals(expected, actual)
}

@Test
fun overflow_x_clip() {
val expected = Style(OVERFLOW_X, "clip").toString()
val actual = KW.inline { overflow_x_clip }
assertEquals(expected, actual)
}

@Test
fun overflow_x_visible() {
val expected = Style(OVERFLOW_X, "visible").toString()
val actual = KW.inline { overflow_x_visible }
assertEquals(expected, actual)
}

@Test
fun overflow_x_scroll() {
val expected = Style(OVERFLOW_X, "scroll").toString()
val actual = KW.inline { overflow_x_scroll }
assertEquals(expected, actual)
}

@Test
fun overflow_y_auto() {
val expected = Style(OVERFLOW_Y, "auto").toString()
val actual = KW.inline { overflow_y_auto }
assertEquals(expected, actual)
}

@Test
fun overflow_y_hidden() {
val expected = Style(OVERFLOW_Y, "hidden").toString()
val actual = KW.inline { overflow_y_hidden }
assertEquals(expected, actual)
}

@Test
fun overflow_y_clip() {
val expected = Style(OVERFLOW_Y, "clip").toString()
val actual = KW.inline { overflow_y_clip }
assertEquals(expected, actual)
}

@Test
fun overflow_y_visible() {
val expected = Style(OVERFLOW_Y, "visible").toString()
val actual = KW.inline { overflow_y_visible }
assertEquals(expected, actual)
}

@Test
fun overflow_y_scroll() {
val expected = Style(OVERFLOW_Y, "scroll").toString()
val actual = KW.inline { overflow_y_scroll }
assertEquals(expected, actual)
}
}