-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make polymer templates dependency optional
Since from Vaadin 24 polymer templates is an optional dependency, UI Unit test should not assume it is present on classpath.
- Loading branch information
1 parent
dba642b
commit 7ea7a1d
Showing
7 changed files
with
100 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
vaadin-testbench-unit-shared/src/test/kotlin/com/vaadin/testbench/unit/internal/AllTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (C) 2022 Vaadin Ltd | ||
* | ||
* This program is available under Commercial Vaadin Developer License | ||
* 4.0 (CVDLv4). | ||
* | ||
* | ||
* For the full License, see <https://vaadin.com/license/cvdl-4.0>. | ||
*/ | ||
|
||
package com.vaadin.testbench.unit.internal | ||
|
||
import kotlin.test.expect | ||
import com.vaadin.flow.component.Tag | ||
import com.vaadin.flow.component.button.Button | ||
import com.vaadin.flow.component.littemplate.LitTemplate | ||
import com.vaadin.flow.component.polymertemplate.PolymerTemplate | ||
import com.vaadin.flow.component.polymertemplate.TemplateParser | ||
import com.vaadin.flow.server.VaadinService | ||
import com.vaadin.flow.templatemodel.TemplateModel | ||
import com.github.mvysny.dynatest.DynaTest | ||
import org.jsoup.nodes.Element | ||
|
||
class AllTests : DynaTest({ | ||
|
||
beforeEach { MockVaadin.setup() } | ||
afterEach { MockVaadin.tearDown() } | ||
|
||
|
||
test("Component.isTemplate") { | ||
expect(false) { Button("foo").isTemplate } | ||
expect(true) { MyLitTemplate().isTemplate } | ||
expect(true) { MyPolymerTemplate().isTemplate } | ||
} | ||
|
||
}) | ||
|
||
internal interface MyModel : TemplateModel | ||
internal class MyTemplateParser : TemplateParser { | ||
override fun getTemplateContent( | ||
clazz: Class<out PolymerTemplate<*>>?, | ||
tag: String?, | ||
service: VaadinService? | ||
): TemplateParser.TemplateData { | ||
return TemplateParser.TemplateData("", Element(tag)) | ||
} | ||
|
||
} | ||
@Tag("my-polymer") | ||
internal class MyPolymerTemplate : PolymerTemplate<MyModel>(MyTemplateParser()) { | ||
|
||
} | ||
@Tag("my-lit") | ||
internal class MyLitTemplate : LitTemplate() |