kotlin-koans-edu-obsolete
kotlin-koans-edu-obsolete copied to clipboard
Html builder test allows incomplete solution, lacking content coloring
The following solution shouldn't be accepted but it. This solution shouldn't be accepted because it doesn't color the content cells but only the header.
fun renderProductTable(): String {
return html {
table {
tr(color = getTitleColor()) {
td {
text("Product")
}
td {
text("Price")
}
td {
text("Popularity")
}
}
val products = getProducts()
products.map {
tr {
td {
text(it.description)
}
td {
text(it.price)
}
td {
text(it.popularity)
}
}
}
}
}.toString()
}
fun getTitleColor() = "#b9c9fe"
fun getCellColor(row: Int, column: Int) = if ((row + column) %2 == 0) "#dce4ff" else "#eff2ff"