Skip to content

Commit

Permalink
added lowercase and test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sun Ning committed Mar 7, 2013
1 parent 85f433c commit 29051c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/hbs/ext.clj
Expand Up @@ -32,3 +32,6 @@


(defhelper uppercase [^Object ctx ^Options options] (defhelper uppercase [^Object ctx ^Options options]
(clojure.string/upper-case ctx)) (clojure.string/upper-case ctx))

(defhelper lowercase [^Object ctx ^Options options]
(clojure.string/lower-case ctx))
4 changes: 4 additions & 0 deletions test/hbs/ext_test.clj
Expand Up @@ -25,3 +25,7 @@
(deftest test-uppercase (deftest test-uppercase
(let [tpl "{{uppercase tom.cat}}"] (let [tpl "{{uppercase tom.cat}}"]
(is (= "HELLO" (render tpl {:tom {:cat "hello"}}))))) (is (= "HELLO" (render tpl {:tom {:cat "hello"}})))))

(deftest test-lowercase
(let [tpl "{{lowercase tom.cat}}"]
(is (= "hello" (render tpl {:tom {:cat "HELLO"}})))))

0 comments on commit 29051c8

Please sign in to comment.