@@ -2,10 +2,10 @@ package org.jetbrains.kotlinx.dataframe.api
22
33import io.kotest.matchers.shouldBe
44import io.kotest.matchers.shouldNotBe
5- import org.jetbrains.kotlinx.dataframe.alsoDebug
65import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.blue
76import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.red
87import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.rgb
8+ import org.jetbrains.kotlinx.dataframe.io.DataFrameHtmlData
99import org.jetbrains.kotlinx.dataframe.io.DisplayConfiguration
1010import org.jetbrains.kotlinx.dataframe.samples.api.TestBase
1111import org.jetbrains.kotlinx.dataframe.samples.api.age
@@ -314,6 +314,7 @@ class FormatTests : TestBase() {
314314 formatted::class .simpleName shouldBe " FormattedFrame"
315315 }
316316
317+ // Issue #982
317318 @Suppress(" ktlint:standard:argument-list-wrapping" )
318319 @Test
319320 fun `formatting a column shouldn't affect nested columns with the same name` () {
@@ -331,11 +332,12 @@ class FormatTests : TestBase() {
331332 .group(" city" ).into(" cityGroup" )
332333 .rename(" cityCopy" ).into(" city" )
333334
334- df.alsoDebug()
335+ val formatted = df.format(" city" ).with { bold and italic and textColor(green) }
336+ val html =
337+ formatted.toStandaloneHtml() + // expand the nested dataframes so we can see the difference
338+ DataFrameHtmlData (script = " document.querySelectorAll('a.expander').forEach(a => a.click());" )
335339
336- df.format().with { background(black) }.toStandaloneHtml().openInBrowser()
337-
338- // affects city, cityGroup.city, and group[*].city
339- df.format(" city" ).with { bold and italic and textColor(green) }.toStandaloneHtml().openInBrowser()
340+ html.toString().split(" color:#00ff00" ).size - 1 shouldBe 12
341+ html.toString().split(" font-style:italic" ).size - 1 shouldBe 6
340342 }
341343}
0 commit comments