@@ -35,3 +35,43 @@ describe "Basic setup", ->
35
35
36
36
expect ($F (select)).toBe " Afghanistan"
37
37
div .remove ()
38
+
39
+ describe " data-placeholder" , ->
40
+
41
+ it " should render" , ->
42
+ tmpl = "
43
+ <select data-placeholder='Choose a Country...'>
44
+ <option value=''></option>
45
+ <option value='United States'>United States</option>
46
+ <option value='United Kingdom'>United Kingdom</option>
47
+ <option value='Afghanistan'>Afghanistan</option>
48
+ </select>
49
+ "
50
+ div = new Element (" div" )
51
+ document .body .insert (div)
52
+ div .update (tmpl)
53
+ select = div .down (" select" )
54
+ expect (select).toBeDefined ()
55
+ new Chosen (select)
56
+
57
+ placeholder = div .down (" .chosen-single > span" )
58
+ expect (placeholder .innerText ).toBe (" Choose a Country..." )
59
+
60
+ it " should render with special characters" , ->
61
+ tmpl = "
62
+ <select data-placeholder='<None>'>
63
+ <option value=''></option>
64
+ <option value='United States'>United States</option>
65
+ <option value='United Kingdom'>United Kingdom</option>
66
+ <option value='Afghanistan'>Afghanistan</option>
67
+ </select>
68
+ "
69
+ div = new Element (" div" )
70
+ document .body .insert (div)
71
+ div .update (tmpl)
72
+ select = div .down (" select" )
73
+ expect (select).toBeDefined ()
74
+ new Chosen (select)
75
+
76
+ placeholder = div .down (" .chosen-single > span" )
77
+ expect (placeholder .innerText ).toBe (" <None>" )
0 commit comments