Skip to content

Commit

Permalink
#162 Test Composite<LitTemplate> as well
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Feb 6, 2024
1 parent 5102a6b commit a1661d3
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.github.mvysny.dynatest.DynaNodeGroup
import com.github.mvysny.dynatest.DynaTestDsl
import com.github.mvysny.dynatest.expectThrows
import com.vaadin.flow.component.Component
import com.vaadin.flow.component.Composite
import com.vaadin.flow.component.Tag
import com.vaadin.flow.component.UI
import com.vaadin.flow.component.dependency.JsModule
Expand Down Expand Up @@ -73,6 +74,21 @@ fun DynaNodeGroup.litTemplateTestBatch(isModuleTest: Boolean) {
expect(setOf(form, form.emailField, form.firstNameField, form.lastNameField)) { form._find<Component>().toSet() }
expect(form.emailField) { form._get<EmailField>() }
}

group("Composite") {
class CompositeForm : Composite<MyForm>()
test("false") {
val form = CompositeForm()
expect(setOf(form, form.content)) { form._find<Component>().toSet() }
form._expectNone<EmailField>()
}
test("true") {
includeVirtualChildrenInTemplates = true
val form = CompositeForm()
expect(setOf(form, form.content, form.content.emailField, form.content.firstNameField, form.content.lastNameField)) { form._find<Component>().toSet() }
expect(form.content.emailField) { form._get<EmailField>() }
}
}
}
}

Expand Down

0 comments on commit a1661d3

Please sign in to comment.