Skip to content

Commit

Permalink
Added button-type & input-type HTML attribute values.
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoejp committed Jul 10, 2023
1 parent babdc2d commit 69ff862
Show file tree
Hide file tree
Showing 4 changed files with 175 additions and 0 deletions.
23 changes: 23 additions & 0 deletions stdlib/source/library/lux/web/html/attribute/type/button.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
[library
[lux (.except Type)
[meta
[macro
["[0]" template]]]]])

... https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
(every .public Type
Text)

(with_template [<name>]
[(the .public <name>
Type
(template.text [<name>]))]

[submit]
[reset]
[button]
)
47 changes: 47 additions & 0 deletions stdlib/source/library/lux/web/html/attribute/type/input.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
[library
[lux (.except Type)
[data
["[0]" text]]
[meta
[macro
["[0]" template]]]]])

... https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types
(every .public Type
Text)

(with_template [<name>]
[(the .public <name>
Type
(|> (template.text [<name>])
(text.replaced "local_date_time" "datetime-local")
(text.replaced "telephone" "tel")
(text.replaced "_" "")))]

[button]
[check_box]
[color]
[date]
[local_date_time]
[email]
[file]
[hidden]
[image]
[month]
[number]
[password]
[radio]
[range]
[reset]
[search]
[submit]
[telephone]
[text]
[time]
[url]
[week]
)
43 changes: 43 additions & 0 deletions stdlib/source/test/lux/web/html/attribute/type/button.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
[library
[lux (.except)
[abstract
[monad (.only do)]]
[data
["[0]" text]
[collection
["[0]" list]
["[0]" set]]]
[math
["[0]" random (.only Random)]
[number
["n" nat]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" /]])

(with_expansions [<tags> (with_template [<name>]
[<name>]

[/.submit]
[/.reset]
[/.button]
)]
(the .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[])
(_.for [/.Type])
(all _.and
(_.coverage [<tags>]
(let [all (is (List /.Type)
(list <tags>))
uniques (set.of_list text.hash all)]
(n.= (list.size all)
(set.size uniques))))
))))
62 changes: 62 additions & 0 deletions stdlib/source/test/lux/web/html/attribute/type/input.lux
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
[library
[lux (.except)
[abstract
[monad (.only do)]]
[data
["[0]" text]
[collection
["[0]" list]
["[0]" set]]]
[math
["[0]" random (.only Random)]
[number
["n" nat]]]
[test
["_" property (.only Test)]]]]
[\\library
["[0]" /]])

(with_expansions [<tags> (with_template [<name>]
[<name>]

[/.button]
[/.check_box]
[/.color]
[/.date]
[/.local_date_time]
[/.email]
[/.file]
[/.hidden]
[/.image]
[/.month]
[/.number]
[/.password]
[/.radio]
[/.range]
[/.reset]
[/.search]
[/.submit]
[/.telephone]
[/.text]
[/.time]
[/.url]
[/.week]
)]
(the .public test
Test
(<| (_.covering /._)
(do [! random.monad]
[])
(_.for [/.Type])
(all _.and
(_.coverage [<tags>]
(let [all (is (List /.Type)
(list <tags>))
uniques (set.of_list text.hash all)]
(n.= (list.size all)
(set.size uniques))))
))))

0 comments on commit 69ff862

Please sign in to comment.