-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
89 additions
and
411 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
...estFixtures/kotlin/de/tschuehly/spring/viewcomponent/core/ThymeleafIntegrationTestBase.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,56 @@ | ||
package de.tschuehly.spring.viewcomponent.core | ||
|
||
import org.junit.jupiter.api.Test | ||
|
||
abstract class ThymeleafIntegrationTestBase: IntegrationTestBase() { | ||
@Test | ||
override fun testNestedActionComponent() { | ||
val expectedHtml = | ||
//language=html | ||
""" | ||
<html> | ||
<body id="layoutviewcomponent"> | ||
<nav> | ||
This is the NavBar | ||
</nav> | ||
<div id="actionviewcomponent"> | ||
<html> | ||
<head> | ||
<script src="http://localhost:35729/livereload.js"></script> | ||
<script defer src="/webjars/htmx.org/dist/htmx.min.js"></script> | ||
</head> | ||
<body id="actionviewcomponent"><h2>ViewAction Get CountUp</h2> | ||
<button hx-get="/custompath/countup" hx-target="#actionviewcomponent">Default ViewAction [GET]</button> | ||
<h3>0</h3> | ||
<h2>ViewAction Post AddItem</h2> | ||
<form hx-post="/actionviewcomponent/additem" hx-target="#actionviewcomponent"><input type="text" name="item"> | ||
<button type="submit">Save Item</button> | ||
</form> | ||
<table> | ||
<tr> | ||
<th>Item</th> | ||
<th>Action</th> | ||
</tr> | ||
</table> | ||
<h2>ViewAction Put/Patch Person Form</h2> | ||
<form style="display: inline-grid; gap: 0.5rem"> | ||
<label>Name<input type="text" id="name" name="name" value="Thomas"></label> | ||
<label>Age: <input type="number" id="age" name="age" value="23"></label> | ||
<label>Location: <input type="text" id="location" name="location" value="Ludwigsburg"></label> | ||
<button type="submit" hx-put="/actionviewcomponent/savepersonput" hx-target="#actionviewcomponent">Save Changes using Put | ||
</button> | ||
<button type="submit" hx-patch="/actionviewcomponent/savepersonpatch" hx-target="#actionviewcomponent">Save Changes using Patch | ||
</button> | ||
</form> | ||
</body> | ||
</html> | ||
</div> | ||
<footer>This is a footer</footer> | ||
</body> | ||
</html> | ||
""".trimIndent() | ||
assertEndpointReturns("/nested-action", expectedHtml) | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
...es/kte-example/src/test/kotlin/de/tschuehly/kteviewcomponentexample/KteIntegrationTest.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
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
3 changes: 1 addition & 2 deletions
3
...mple/src/main/java/de/tschuehly/example/thymeleafjava/web/action/ActionViewComponent.html
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
7 changes: 3 additions & 4 deletions
7
...mple/src/main/java/de/tschuehly/example/thymeleafjava/web/layout/LayoutViewComponent.html
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 |
---|---|---|
@@ -1,16 +1,15 @@ | ||
<html> | ||
<body> | ||
|
||
<nav> | ||
This is the NavBar | ||
This a NavBar | ||
</nav> | ||
<body> | ||
<!--/*@thymesVar id="layoutView" type="de.tschuehly.example.thymeleafjava.web.layout.LayoutViewComponent.LayoutView"*/--> | ||
<div view:component="${layoutView.nestedViewComponent()}"></div> | ||
|
||
</body> | ||
<footer> | ||
This is a footer | ||
</footer> | ||
</body> | ||
|
||
|
||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
rootProject.name = "thymeleaf-kotlin-example" | ||
|
||
//includeBuild("..\\..\\thymeleaf"){ | ||
// dependencySubstitution { | ||
// substitute(module("de.tschuehly:spring-view-component-thymeleaf")).using(project(":")) | ||
// } | ||
//} | ||
//includeBuild("..\\..\\core"){ | ||
// dependencySubstitution { | ||
// substitute(module("de.tschuehly:spring-view-component-core")).using(project(":")) | ||
// } | ||
//} | ||
//includeBuild("..\\..\\jte\\jte-compiler"){ | ||
// dependencySubstitution { | ||
// substitute(module("de.tschuehly:spring-view-component-jte-compiler")).using(project(":")) | ||
// } | ||
//} | ||
includeBuild("..\\..\\thymeleaf"){ | ||
dependencySubstitution { | ||
substitute(module("de.tschuehly:spring-view-component-thymeleaf")).using(project(":")) | ||
} | ||
} | ||
includeBuild("..\\..\\core"){ | ||
dependencySubstitution { | ||
substitute(module("de.tschuehly:spring-view-component-core")).using(project(":")) | ||
} | ||
} | ||
includeBuild("..\\..\\jte\\jte-compiler"){ | ||
dependencySubstitution { | ||
substitute(module("de.tschuehly:spring-view-component-jte-compiler")).using(project(":")) | ||
} | ||
} |
Oops, something went wrong.