aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils/HtmlUtils.kt
blob: 0748d91a931434ab61c9f9914e040f6046c665cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package utils

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import org.jetbrains.dokka.base.renderers.html.SearchRecord
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import org.jsoup.select.Elements

internal fun TestOutputWriter.navigationHtml(): Element = contents.getValue("navigation.html").let { Jsoup.parse(it) }

internal fun TestOutputWriter.pagesJson(): List<SearchRecord> = jacksonObjectMapper().readValue(contents.getValue("scripts/pages.json"))

internal fun Elements.selectNavigationGrid(): Element {
    return this.select("div.overview").select("span.nav-link-grid").single()
}