Render custom tag briefs for enum entries and constructor - #4265
Render custom tag briefs for enum entries and constructor#4265strangesource wants to merge 2 commits into
Conversation
whyoleg
left a comment
There was a problem hiding this comment.
Sorry for the delay with reviewing :(
The changes look good, but we can simplify the test further by using Style, which will enable us to easily locate all comments with that style.
I would not say that it is fully idiomatic, but it should simplify the test logic.
| .filterIsInstance<ContentPage>() | ||
| .single { it.name == "Foo" } | ||
|
|
||
| page.content.assertNode { |
There was a problem hiding this comment.
Overall, the test is correct, but it could be done a bit more cleanly. Let's create an additional Style object, add it via CustomTagContentProvider:
// new style
object TestCustomStyle: Style
class TestCustomTagContentProvider : CustomTagContentProvider {
override fun isApplicable(customTag: CustomTagWrapper): Boolean {
return customTag.name == "customTag"
}
override fun PageContentBuilder.DocumentableContentBuilder.contentForBrief(
sourceSet: DokkaConfiguration.DokkaSourceSet,
customTag: CustomTagWrapper
) {
// add style
comment(customTag.children.single(), styles = mainStyles + setOf(TestCustomStyle))
}
}And in that case, it's possible to find it and do an assertion rather easily:
val customTagContents = page.content.withDescendants().filter {
it.style.contains(TestCustomStyle)
}.toList()
assertEquals(1, customTagContents.size)
customTagContents.single().assertNode {
group {
+"custom tag for constructor"
}
}| import kotlin.test.Test | ||
| import kotlin.test.assertEquals | ||
|
|
||
| class CustomTagContentProviderTest : BaseAbstractTest() { |
There was a problem hiding this comment.
Would you also mind adding a test for class documentation and some function documentation with custom tags, so that we have all cases covered in one test?
|
@strangesource, are you still willing to finalize the PR? |
Custom tags brief not rendered for enum entries and constructors
Contrary to what the documentation on the CustomTagContentProvider suggests, the custom tag brief is not rendered for constructors and enum entries. Reported in #4255.
Changes
Issues encountered
While setting up the unit tests i struggled with the assertion DSL. It doesn't seem fight to assert the whole page tree until the node I actually want to ensure is present, maybe you have some suggestion on how this could be improved.