aboutsummaryrefslogtreecommitdiff
path: root/tests/test/html/component.scm
blob: 97581c505a70eae498d1db478f2cb96e1484c287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
(define-module (test html caltable)
  :use-module (srfi srfi-64)
  :use-module (srfi srfi-64 test-error)
  :use-module (srfi srfi-88)
  :use-module (calp translation)

  :use-module (calp html components)
  )

(test-equal '(*TOP* (*PI* xml "version=\"1.0\" encoding=\"utf-8\"")
                    (html (@ (xmlns "http://www.w3.org/1999/xhtml"))
                          body))
  (xhtml-doc body))

(test-equal '(*TOP* (*PI* xml "version=\"1.0\" encoding=\"utf-8\"")
                    (html (@ (xmlns "http://www.w3.org/1999/xhtml"))
                          (b "Hello, World!")))
  (xhtml-doc ,'(b "Hello, World!")))

(test-equal
    '(*TOP* (*PI* xml "version=\"1.0\" encoding=\"utf-8\"")
            (html (@ (xmlns "http://www.w3.org/1999/xhtml")
                     (lang sv))
                  body))
    (xhtml-doc (@ (lang sv)) body))


;; TODO Slider not tested, due to depending on gensyms, and really needing
;;      integration testing to be worth anything.


(test-equal
    '(button (@ (class "btn") (onclick "onclick")) "Body")
  (btn onclick: "onclick" "Body"))

(test-equal "href button, without body"
    '(a (@ (class "btn") (href "href")) #f)
  (btn href: "href"))

(test-error 'wrong-type-arg
  (btn href: "a" onclick: "b"))

(test-equal "btn no specifier, but class"
  '(button (@ (class "btn test")) "body")
  (btn class: '("test") "body"))

;; tabset
;; with-label

(test-equal '(link (@ (type "text/css") (rel "stylesheet") (href "style.css")))
  (include-css "style.css"))

(test-equal
    '(link (@ (type "text/css") (rel "stylesheet") (href "style.css") (class "test")))
  (include-css "style.css" '(class "test")))

(test-equal
    '(link (@ (type "text/css") (rel "alternate stylesheet") (href "style.css")))
  (include-alt-css "style.css"))