|
|
@ -16,6 +16,7 @@ import kotlin.test.assertEquals |
|
|
|
|
|
|
|
|
|
|
|
class ColorTests { |
|
|
|
class ColorTests { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Suppress("DEPRECATION") |
|
|
|
fun rgbTestDeprecated() = runTest { |
|
|
|
fun rgbTestDeprecated() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(Color.RGB(0, 0, 0)) } }) |
|
|
|
Div({ style { color(Color.RGB(0, 0, 0)) } }) |
|
|
@ -39,6 +40,7 @@ class ColorTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Suppress("DEPRECATION") |
|
|
|
fun rgbaTestDeprecated() = runTest { |
|
|
|
fun rgbaTestDeprecated() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(Color.RGBA(0, 220, 0, 0.2)) } }) |
|
|
|
Div({ style { color(Color.RGBA(0, 220, 0, 0.2)) } }) |
|
|
@ -66,49 +68,50 @@ class ColorTests { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun hslaTestDeprecated() = runTest { |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
|
|
|
|
fun hslTestDeprecated() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(Color.HSLA(100, 100, 50, 1)) } }) |
|
|
|
Div({ style { color(Color.HSL(100, 120, 50)) } }) |
|
|
|
Div({ style { color(Color.HSLA(235, 100, 50, .5)) } }) |
|
|
|
Div({ style { color(Color.HSL(235, 100, 50)) } }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgba(0, 21, 255, 0.5)", (root.children[1] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(0, 21, 255)", (root.children[1] as HTMLElement).style.color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun hslaTest() = runTest { |
|
|
|
fun hslTest() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(hsla(100, 100, 50, 1)) } }) |
|
|
|
Div({ style { color(hsl(100, 120, 50)) } }) |
|
|
|
Div({ style { color(hsla(235, 100, 50, .5)) } }) |
|
|
|
Div({ style { color(hsl(235, 100, 50)) } }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgba(0, 21, 255, 0.5)", (root.children[1] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(0, 21, 255)", (root.children[1] as HTMLElement).style.color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun hslTestDeprecated() = runTest { |
|
|
|
@Suppress("DEPRECATION") |
|
|
|
|
|
|
|
fun hslaTestDeprecated() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(Color.HSL(100, 120, 50)) } }) |
|
|
|
Div({ style { color(Color.HSLA(100, 100, 50, 1)) } }) |
|
|
|
Div({ style { color(Color.HSL(235, 100, 50)) } }) |
|
|
|
Div({ style { color(Color.HSLA(235, 100, 50, .5)) } }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(0, 21, 255)", (root.children[1] as HTMLElement).style.color) |
|
|
|
assertEquals("rgba(0, 21, 255, 0.5)", (root.children[1] as HTMLElement).style.color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun hslTest() = runTest { |
|
|
|
fun hslaTest() = runTest { |
|
|
|
composition { |
|
|
|
composition { |
|
|
|
Div({ style { color(hsl(100, 120, 50)) } }) |
|
|
|
Div({ style { color(hsla(100, 100, 50, 1)) } }) |
|
|
|
Div({ style { color(hsl(235, 100, 50)) } }) |
|
|
|
Div({ style { color(hsla(235, 100, 50, .5)) } }) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(85, 255, 0)", (root.children[0] as HTMLElement).style.color) |
|
|
|
assertEquals("rgb(0, 21, 255)", (root.children[1] as HTMLElement).style.color) |
|
|
|
assertEquals("rgba(0, 21, 255, 0.5)", (root.children[1] as HTMLElement).style.color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -394,6 +397,6 @@ class ColorTests { |
|
|
|
assertEquals("yellowgreen", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("yellowgreen", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("yellow", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("yellow", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("transparent", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("transparent", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("currentcolor", (root.children[counter++] as HTMLElement).style.color) |
|
|
|
assertEquals("currentcolor", (root.children[counter] as HTMLElement).style.color) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|