kotlin-koans-edu-obsolete icon indicating copy to clipboard operation
kotlin-koans-edu-obsolete copied to clipboard

Html builder test allows incomplete solution, lacking content coloring

Open AdrienHorgnies opened this issue 6 years ago • 0 comments

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"

AdrienHorgnies avatar Jun 23 '18 11:06 AdrienHorgnies