Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

XML documents need to be able to contain text content.

  • Loading branch information...
commit 82d06b4fe399208a716fd20489e8800cfe0ae415 1 parent ae03ec2
Giles Alexander authored
Showing with 8 additions and 2 deletions.
  1. +5 −1 src/janus/verify.clj
  2. +3 −1 test/janus/test/verify_test.clj
6 src/janus/verify.clj
View
@@ -57,7 +57,11 @@
els (if (map? (first attrs-and-els))
(rest attrs-and-els)
attrs-and-els)]
- (apply xml/element (concat [tag attrs] (map vec-to-el els)))))
+ (apply xml/element (concat [tag attrs]
+ (map (fn [el] (if (string? el)
+ el
+ (vec-to-el el)))
+ els)))))
(defn to-xml [tree]
(xml/emit-str (vec-to-el tree)))
4 test/janus/test/verify_test.clj
View
@@ -79,7 +79,9 @@
(fact
(to-xml [:tag]) => (contains "<tag></tag>")
(to-xml [:tag {:attr "value"}]) => (contains "<tag attr=\"value\">")
- (to-xml [:tag [:sub]]) => (contains "<tag><sub></sub>"))
+ (to-xml [:tag [:sub]]) => (contains "<tag><sub></sub>")
+ (to-xml [:tag "blah"]) => (contains "<tag>blah</tag>")
+ (to-xml [:tag "blah" [:sub {:attr "val"}]]) => (contains "<tag>blah<sub attr=\"val\"></sub></tag"))
(fact
(body-from ..contract.. {}) => "data"
Please sign in to comment.
Something went wrong with that request. Please try again.