Testing builder call syntax

This commit is contained in:
2019-11-17 20:37:46 +01:00
parent ff761487a3
commit a407d7e486
3 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
group 'nl.astraeus' group 'nl.astraeus'
version '0.1.10' version '0.1.14-SNAPSHOT'
apply plugin: 'kotlin2js' apply plugin: 'kotlin2js'
apply plugin: 'kotlin-dce-js' apply plugin: 'kotlin-dce-js'

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="komp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.version="0.1.10-SNAPSHOT" type="JAVA_MODULE" version="4"> <module external.linked.project.id="komp" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="nl.astraeus" external.system.module.version="0.1.14-SNAPSHOT" type="JAVA_MODULE" version="4">
<component name="FacetManager"> <component name="FacetManager">
<facet type="kotlin-language" name="Kotlin"> <facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JavaScript " allPlatforms="JS []" useProjectSettings="false" pureKotlinSourceFolders="$MODULE_DIR$/src/test/kotlin;/home/rnentjes/Development/komp/komp/src/main/kotlin"> <configuration version="3" platform="JavaScript " allPlatforms="JS []" useProjectSettings="false" pureKotlinSourceFolders="$MODULE_DIR$/src/test/kotlin;/home/rnentjes/Development/komp/komp/src/main/kotlin">
@@ -34,8 +34,8 @@
<exclude-output /> <exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" type="kotlin-test" /> <sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" type="kotlin-test" />
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" type="kotlin-source" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="kotlin-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" /> <excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" /> <excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/out" /> <excludeFolder url="file://$MODULE_DIR$/out" />

View File

@@ -26,14 +26,15 @@ abstract class Komponent {
open fun create(): HTMLElement { open fun create(): HTMLElement {
val consumer = HtmlBuilder(this, document) val consumer = HtmlBuilder(this, document)
val result = render(consumer) consumer.render()
val result = consumer.finalize()
element = result element = result
return result return result
} }
abstract fun render(consumer: HtmlBuilder): HTMLElement abstract fun HtmlBuilder.render()
open fun style(className: String, vararg imports: CssStyle, block: CSSStyleDeclaration.() -> Unit = {}) { open fun style(className: String, vararg imports: CssStyle, block: CSSStyleDeclaration.() -> Unit = {}) {
val style = (document.createElement("div") as HTMLDivElement).style val style = (document.createElement("div") as HTMLDivElement).style