Skip to content

Commit

Permalink
replace dynatest with junit5
Browse files Browse the repository at this point in the history
  • Loading branch information
mvysny committed Oct 28, 2024
1 parent 03bd1d9 commit ee1470c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ open class AbstractAllTests10(val isModuleTest: Boolean) {
@Nested inner class LitTemplateTests : AbstractLitTemplateTests(isModuleTest)
@Nested inner class NpmTemplateTests : AbstractNpmPolymerTemplateTests(isModuleTest)
@Nested inner class DialogTests : AbstractDialogTests()
@Nested inner class CompositeTests : AbstractCompositeTests()
}

/**
Expand All @@ -58,9 +59,6 @@ fun DynaNodeGroup.allTests(isModuleTest: Boolean) {
Locale.setDefault(Locale.ENGLISH)
}

group("Composite") {
compositeTests()
}
group("radio button") {
radioButtonTests()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package com.github.mvysny.kaributesting.v10

import com.github.mvysny.dynatest.DynaNodeGroup
import com.github.mvysny.dynatest.DynaTestDsl
import com.vaadin.flow.component.Composite
import com.vaadin.flow.component.button.Button
import com.vaadin.flow.component.html.Div
import com.vaadin.flow.component.orderedlayout.FlexLayout
import com.vaadin.flow.component.orderedlayout.VerticalLayout
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

@DynaTestDsl
internal fun DynaNodeGroup.compositeTests() {
beforeEach { MockVaadin.setup() }
afterEach { MockVaadin.tearDown() }
abstract class AbstractCompositeTests() {
@BeforeEach fun fakeVaadin() { MockVaadin.setup() }
@AfterEach fun tearDownVaadin() { MockVaadin.tearDown() }

test("Composite<Button> doesn't duplicate the button") {
@Test fun `CompositeButton doesn't duplicate the button`() {
class MyButton : Composite<Button>()

val btn = MyButton()
btn._expectOne<Button>()
}

test("Composite<VerticalLayout> doesn't duplicate its children") {
@Test fun `CompositeVerticalLayout doesn't duplicate its children`() {
class MyLayout : Composite<VerticalLayout>() {
init {
content.add(Button("Foo"))
Expand All @@ -31,7 +31,7 @@ internal fun DynaNodeGroup.compositeTests() {
l._expectOne<Button>()
}

test("Composite<FlexLayout> doesn't duplicate its children") {
@Test fun `CompositeFlexLayout doesn't duplicate its children`() {
class MyLayout : Composite<FlexLayout>() {
init {
content.add(Button("Foo"))
Expand All @@ -42,7 +42,7 @@ internal fun DynaNodeGroup.compositeTests() {
l._expectOne<Button>()
}

test("Composite<Div> doesn't duplicate its children") {
@Test fun `CompositeDiv doesn't duplicate its children`() {
class MyLayout : Composite<Div>() {
init {
content.add(Button("Foo"))
Expand Down

0 comments on commit ee1470c

Please sign in to comment.