Skip to content

Testing for certain html tags with LitRenderer #175

Open
@nbabb

Description

I am testing a TreeGrid that uses a LitRenderer. I am calling

GridKt._getFormattedRow()

on my expected row, but am getting back only the extracted text portions. This particular renderer conditionally includes an anchor tag, based on some business logic. When I debug into

Renderers._getPresentationValue

in particular these lines

        val renderedLitTemplateHtml: String = renderLitTemplate(templateExpression, valueProviders, rowObject)
        Jsoup.parse(renderedLitTemplateHtml).textRecursively

I see my html in the rendererdLitTemplateHtml value

<vaadin-grid-tree-toggle @click=${onClick} .leaf=true .expanded=${model.expanded} .level=${model.level}><img src='svg/myobj.svg' alt=''>&nbsp;&nbsp;<span class='tree-node-labels'>     <a href='myobj/2' target='_blank'>FOO</a>     <span class='tree-node-labels-subheader target-node'>Bar</span>     <span class='tree-node-labels-subheader ' hidden=true>Inactive</span></span></vaadin-grid-tree-toggle>

but then the Jsoup parsing returns only a minimal String representation, i.e. FOO Bar Inactive. What I'd like to be able to do is assert on whether there is an anchor tag in the rendereredLitTemplateHtml variable String. Any thoughts on this, other than trying to roll my own method? Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

enhancementNew feature or requestquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions