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 2cb857d commit e0ddd9f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ open class AbstractAllTests10(val isModuleTest: Boolean) {
@Nested inner class RadioButtonTests : AbstractRadioButtonTests()
@Nested inner class ListBoxTests : AbstractListBoxTests()
@Nested inner class CheckboxGroupTests : AbstractCheckboxGroupTests()
@Nested inner class DetailsTests : AbstractDetailsTests()
@Nested inner class MessageTests : AbstractMessageTests()
}

/**
Expand All @@ -62,12 +64,6 @@ fun DynaNodeGroup.allTests(isModuleTest: Boolean) {
Locale.setDefault(Locale.ENGLISH)
}

group("Details") {
detailsTests()
}
group("Messages") {
messageTests()
}
group("HasValidation") {
hasValidationTests()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package com.github.mvysny.kaributesting.v10

import com.github.mvysny.dynatest.DynaNodeGroup
import com.github.mvysny.dynatest.DynaTestDsl
import com.vaadin.flow.component.details.Details
import com.vaadin.flow.component.html.Span
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

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

// for other Dialog-related tests see MockVaadinTest.kt
test("smoke") {
@Test fun smoke() {
val d = Details(Span("Contact"), Span("Foo"))
d._expectOne<Span> { text = "Contact" }
d._expectOne<Span> { text = "Foo" }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
package com.github.mvysny.kaributesting.v10

import com.github.mvysny.dynatest.DynaNodeGroup
import com.github.mvysny.dynatest.DynaTestDsl
import com.vaadin.flow.component.messages.MessageInput
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Nested
import org.junit.jupiter.api.Test
import kotlin.test.expect

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

group("MessageInput") {
test("submit event") {
@Nested inner class MessageInputTests {
@Test fun `submit event`() {
lateinit var msg: String
val messageInput = MessageInput()
messageInput.addSubmitListener { msg = it.value }
Expand Down

0 comments on commit e0ddd9f

Please sign in to comment.