0 | ||| Main module exporting all the necessary modules for using this library.
  1 | module Text.Html
  2 |
  3 | import public Data.Either
  4 | import public Data.List1
  5 | import public Data.String
  6 |
  7 | import public Text.Html.Attributes
  8 | import public Text.Html.Attributes.Types
  9 | import public Text.Html.Attributes.Validation
 10 | import public Text.Html.Elements
 11 | import public Text.Html.Elements.NoAttr
 12 | import public Text.Html.Elements.Raw
 13 | import public Text.Html.Elements.Runtime
 14 | import public Text.Html.Elements.Types
 15 | import public Text.Html.Elements.Validation
 16 | import public Text.Html.Generator
 17 | import public Text.Html.Types
 18 | import public Text.Html.Utils
 19 | import public Text.Html.Values
 20 |
 21 | %default total
 22 |
 23 | --------------------------------------------------------------------------------
 24 | -- Compile time tests
 25 | --------------------------------------------------------------------------------
 26 |
 27 | -- # Attributes
 28 |
 29 | ||| Non empty `String` is accepted.
 30 | test_content_str : Attribute
 31 | test_content_str = content "test"
 32 |
 33 | failing
 34 |
 35 |   ||| Content cannot be empty.
 36 |   test_content_empty : Attribute
 37 |   test_content_empty = content ""
 38 |
 39 | failing
 40 |
 41 |   ||| Content cannot be white spaces only.
 42 |   test_content_whitespaces : Attribute
 43 |   test_content_whitespaces = content "  "
 44 |
 45 | ||| Non empty `String` is accepted.
 46 | test_name_str : Attribute
 47 | test_name_str = name "test"
 48 |
 49 | failing
 50 |
 51 |   ||| Name cannot be empty.
 52 |   test_name_empty : Attribute
 53 |   test_name_empty = name ""
 54 |
 55 | failing
 56 |
 57 |   ||| Name cannot be white spaces only.
 58 |   test_name_whitespaces : Attribute
 59 |   test_name_whitespaces = name "  "
 60 |
 61 | -- # Elements
 62 |
 63 | ||| `br` succeeds.
 64 | test_br : List Element
 65 | test_br = br
 66 |
 67 | ||| `br` with `id` attribute succeeds.
 68 | test_br_id : List Element
 69 | test_br_id = br [id "test"]
 70 |
 71 | failing
 72 |
 73 |   ||| `br` with `href` attribute fails.
 74 |   test_br_href : List Element
 75 |   test_br_href = br [href "https://idris-lang.org"]
 76 |
 77 | ||| `button` succeeds.
 78 | test_button : List Element
 79 | test_button = button []
 80 |
 81 | ||| `button` with `id` attribute succeeds.
 82 | test_button_id : List Element
 83 | test_button_id = button [id "test"]
 84 |
 85 | failing
 86 |
 87 |   ||| `button` with `href` attributes fails.
 88 |   test_button_href : List Element
 89 |   test_button_href = button [href "https://idris-lang.org"]
 90 |
 91 | ||| None empty `String` is accepted.
 92 | test_title_str : List Element
 93 | test_title_str = title "test"
 94 |
 95 | failing
 96 |
 97 |   ||| Title cannot be empty.
 98 |   test_title_empty : List Element
 99 |   test_title_empty = title ""
100 |
101 | failing
102 |
103 |   ||| Title cannot be white spaces only.
104 |   title_name_whitespaces : List Element
105 |   title_name_whitespaces = title "  "
106 |