From 363b34ec4f558bdc848461b41d7c5d8adbe3c1de Mon Sep 17 00:00:00 2001 From: severn-everett Date: Tue, 25 Jun 2024 07:56:39 +0200 Subject: [PATCH] Using correct string type for input attribute "autocomplete" (#278) --- buildSrc/src/main/resources/html_5.xsd | 77 +++++++++++++++++-- src/commonMain/kotlin/generated/gen-enums.kt | 62 +++++++++++++++ src/commonMain/kotlin/generated/gen-tags-i.kt | 6 +- src/jvmTest/kotlin/streaming.kt | 13 ++-- 4 files changed, 142 insertions(+), 16 deletions(-) diff --git a/buildSrc/src/main/resources/html_5.xsd b/buildSrc/src/main/resources/html_5.xsd index 8319e888..a806d3a4 100644 --- a/buildSrc/src/main/resources/html_5.xsd +++ b/buildSrc/src/main/resources/html_5.xsd @@ -1433,14 +1433,7 @@ - - - - - - - - + @@ -2033,6 +2026,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/commonMain/kotlin/generated/gen-enums.kt b/src/commonMain/kotlin/generated/gen-enums.kt index 2e945f10..61f59814 100644 --- a/src/commonMain/kotlin/generated/gen-enums.kt +++ b/src/commonMain/kotlin/generated/gen-enums.kt @@ -263,6 +263,68 @@ enum class InputType(override val realValue : String) : AttributeEnum { } internal val inputTypeValues : Map = InputType.entries.associateBy { it.realValue } +@Suppress("unused", "ConstPropertyName") +object InputAutoComplete { + const val on : String = "on" + const val off : String = "off" + const val addressLine1 : String = "address-line1" + const val addressLine2 : String = "address-line2" + const val addressLine3 : String = "address-line3" + const val addressLevel1 : String = "address-level1" + const val addressLevel2 : String = "address-level2" + const val addressLevel3 : String = "address-level3" + const val addressLevel4 : String = "address-level4" + const val streetAddress : String = "street-address" + const val country : String = "country" + const val countryName : String = "country-name" + const val postalCode : String = "postal-code" + const val name : String = "name" + const val additionalName : String = "additional-name" + const val familyName : String = "family-name" + const val givenName : String = "given-name" + const val honoricPrefix : String = "honoric-prefix" + const val honoricSuffix : String = "honoric-suffix" + const val nickname : String = "nickname" + const val organizationTitle : String = "organization-title" + const val username : String = "username" + const val newPassword : String = "new-password" + const val currentPassword : String = "current-password" + const val bday : String = "bday" + const val bdayDay : String = "bday-day" + const val bdayMonth : String = "bday-month" + const val bdayYear : String = "bday-year" + const val sex : String = "sex" + const val onETimeCode : String = "one-time-code" + const val organization : String = "organization" + const val ccName : String = "cc-name" + const val ccGivenName : String = "cc-given-name" + const val ccAdditionalName : String = "cc-additional-name" + const val ccFamilyName : String = "cc-family-name" + const val ccNumber : String = "cc-number" + const val ccExp : String = "cc-exp" + const val ccExpMonth : String = "cc-exp-month" + const val ccExpYear : String = "cc-exp-year" + const val ccCsc : String = "cc-csc" + const val ccType : String = "cc-type" + const val transactionCurrency : String = "transaction-currency" + const val transactionAmount : String = "transaction-amount" + const val language : String = "language" + const val url : String = "url" + const val email : String = "email" + const val photo : String = "photo" + const val tel : String = "tel" + const val telCountryCode : String = "tel-country-code" + const val telNational : String = "tel-national" + const val telAreaCode : String = "tel-area-code" + const val telLocal : String = "tel-local" + const val telLocalPrefix : String = "tel-local-prefix" + const val telLocalSuffix : String = "tel-local-suffix" + const val telExtension : String = "tel-extension" + const val impp : String = "impp" + + val values : List = listOf("on", "off", "addressLine1", "addressLine2", "addressLine3", "addressLevel1", "addressLevel2", "addressLevel3", "addressLevel4", "streetAddress", "country", "countryName", "postalCode", "name", "additionalName", "familyName", "givenName", "honoricPrefix", "honoricSuffix", "nickname", "organizationTitle", "username", "newPassword", "currentPassword", "bday", "bdayDay", "bdayMonth", "bdayYear", "sex", "onETimeCode", "organization", "ccName", "ccGivenName", "ccAdditionalName", "ccFamilyName", "ccNumber", "ccExp", "ccExpMonth", "ccExpYear", "ccCsc", "ccType", "transactionCurrency", "transactionAmount", "language", "url", "email", "photo", "tel", "telCountryCode", "telNational", "telAreaCode", "telLocal", "telLocalPrefix", "telLocalSuffix", "telExtension", "impp") +} + @Suppress("unused", "EnumEntryName") enum class InputFormEncType(override val realValue : String) : AttributeEnum { multipartFormData("multipart/form-data"), diff --git a/src/commonMain/kotlin/generated/gen-tags-i.kt b/src/commonMain/kotlin/generated/gen-tags-i.kt index ec8a1434..3c852de6 100644 --- a/src/commonMain/kotlin/generated/gen-tags-i.kt +++ b/src/commonMain/kotlin/generated/gen-tags-i.kt @@ -121,9 +121,9 @@ open class INPUT(initialAttributes : Map, override val consumer get() = attributeBooleanTicker[this, "autofocus"] set(newValue) {attributeBooleanTicker[this, "autofocus"] = newValue} - var autoComplete : Boolean - get() = attributeBooleanBooleanOnOff[this, "autocomplete"] - set(newValue) {attributeBooleanBooleanOnOff[this, "autocomplete"] = newValue} + var autoComplete : String + get() = attributeStringString[this, "autocomplete"] + set(newValue) {attributeStringString[this, "autocomplete"] = newValue} var checked : Boolean get() = attributeBooleanTicker[this, "checked"] diff --git a/src/jvmTest/kotlin/streaming.kt b/src/jvmTest/kotlin/streaming.kt index ae796264..b7388dd3 100644 --- a/src/jvmTest/kotlin/streaming.kt +++ b/src/jvmTest/kotlin/streaming.kt @@ -214,11 +214,11 @@ class TestStreaming { } @Test fun `test form with button`() { - assertEquals("
" + - "var1" + + assertEquals( + "var1" + "var2" + - "" + - "
", + "" + + "", StringBuilder().appendHTML(false).form("/someurl") { checkBoxInput(name = "cb1") { +"var1" @@ -227,6 +227,9 @@ class TestStreaming { disabled = true +"var2" } + textInput(name = "t1") { + autoComplete = InputAutoComplete.impp + } submitInput { value = "Go!" @@ -240,7 +243,7 @@ class TestStreaming { val timeSource = TimeSource.Monotonic val now = timeSource.markNow() - var measuredDuration = Duration.INFINITE + val measuredDuration: Duration val rs = builder.measureTime(timeSource = timeSource).div { val measuredStart = timeSource.markNow()