forked from weavejester/hiccup
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix combined dot-notation and non-literal classes
Generate the correct class attribute of an element when the class names are both present as: - part of the element keyword (using the dot notation) - a non-literal value of the :class key in the attribute map (specifically when using a symbol as the value). Fixes issue weavejester#143
- Loading branch information
Pieter van Prooijen
committed
Apr 22, 2018
1 parent
846d7ef
commit 9d912e6
Showing
3 changed files
with
49 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
(ns hiccup.compiler-test | ||
(:require [hiccup.compiler :refer [render-element]] | ||
[clojure.test :refer :all])) | ||
|
||
(deftest render-element-test | ||
(testing "render non-literal class names when combined with tag classes" | ||
(is (= (let [x "attr-class"] | ||
(render-element [:a.tag-class {:class x}])) | ||
"<a class=\"tag-class attr-class\"></a>")) | ||
(is (= (render-element [:a.tag-class {:class 'x}]) | ||
"<a class=\"tag-class x\"></a>")))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters