aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils/HtmlUtils.kt
blob: cb700a949db6a690394732e91e2c54fcde437529 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
 * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

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()
}