@@ -2,10 +2,10 @@ package org.jetbrains.kotlinx.dataframe.api
2
2
3
3
import io.kotest.matchers.shouldBe
4
4
import io.kotest.matchers.shouldNotBe
5
- import org.jetbrains.kotlinx.dataframe.alsoDebug
6
5
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.blue
7
6
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.red
8
7
import org.jetbrains.kotlinx.dataframe.api.FormattingDsl.rgb
8
+ import org.jetbrains.kotlinx.dataframe.io.DataFrameHtmlData
9
9
import org.jetbrains.kotlinx.dataframe.io.DisplayConfiguration
10
10
import org.jetbrains.kotlinx.dataframe.samples.api.TestBase
11
11
import org.jetbrains.kotlinx.dataframe.samples.api.age
@@ -314,6 +314,7 @@ class FormatTests : TestBase() {
314
314
formatted::class .simpleName shouldBe " FormattedFrame"
315
315
}
316
316
317
+ // Issue #982
317
318
@Suppress(" ktlint:standard:argument-list-wrapping" )
318
319
@Test
319
320
fun `formatting a column shouldn't affect nested columns with the same name` () {
@@ -331,11 +332,12 @@ class FormatTests : TestBase() {
331
332
.group(" city" ).into(" cityGroup" )
332
333
.rename(" cityCopy" ).into(" city" )
333
334
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());" )
335
339
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
340
342
}
341
343
}
0 commit comments