@@ -3222,8 +3222,8 @@ public function testSelectAsCheckbox() {
3222
3222
$ expected = array (
3223
3223
'input ' => array ('type ' => 'hidden ' , 'name ' => 'data[Model][multi_field] ' , 'value ' => '' , 'id ' => 'ModelMultiField ' ),
3224
3224
array ('div ' => array ('class ' => 'checkbox ' )),
3225
- array ('input ' => array ('type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' , 'value ' => '1/2 ' , 'id ' => 'ModelMultiField12 ' )),
3226
- array ('label ' => array ('for ' => 'ModelMultiField12 ' )),
3225
+ array ('input ' => array ('type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' , 'value ' => '1/2 ' , 'id ' => 'ModelMultiField1/2 ' )),
3226
+ array ('label ' => array ('for ' => 'ModelMultiField1/2 ' )),
3227
3227
'half ' ,
3228
3228
'/label ' ,
3229
3229
'/div ' ,
@@ -4150,6 +4150,50 @@ public function testRadioWithCreate() {
4150
4150
);
4151
4151
}
4152
4152
4153
+ /**
4154
+ * testDomIdSuffix method
4155
+ *
4156
+ * @return void
4157
+ */
4158
+ public function testDomIdSuffix () {
4159
+ $ result = $ this ->Form ->domIdSuffix ('1 string with 1$-dollar signs ' );
4160
+ $ this ->assertEquals ('1StringWith1$-dollarSigns ' , $ result );
4161
+
4162
+ $ result = $ this ->Form ->domIdSuffix ('<abc x="foo" y= \'bar \'> ' );
4163
+ $ this ->assertEquals ('AbcX=FooY=Bar ' , $ result );
4164
+
4165
+ $ result = $ this ->Form ->domIdSuffix ('1 string with 1$-dollar signs ' , 'xhtml ' );
4166
+ $ this ->assertEquals ('1StringWith1-dollarSigns ' , $ result );
4167
+
4168
+ $ result = $ this ->Form ->domIdSuffix ('<abc x="foo" y= \'bar \'> ' , 'xhtml ' );
4169
+ $ this ->assertEquals ('AbcXFooYBar ' , $ result );
4170
+ }
4171
+
4172
+ /**
4173
+ * testDomIdSuffixCollisionResolvement()
4174
+ *
4175
+ * @return void
4176
+ */
4177
+ public function testDomIdSuffixCollisionResolvement () {
4178
+ $ result = $ this ->Form ->domIdSuffix ('a>b ' );
4179
+ $ this ->assertEquals ('AB ' , $ result );
4180
+
4181
+ $ result = $ this ->Form ->domIdSuffix ('a<b ' );
4182
+ $ this ->assertEquals ('AB1 ' , $ result );
4183
+
4184
+ $ result = $ this ->Form ->domIdSuffix ('a \'b ' );
4185
+ $ this ->assertEquals ('AB2 ' , $ result );
4186
+
4187
+ $ result = $ this ->Form ->domIdSuffix ('1 string with 1$-dollar ' , 'xhtml ' );
4188
+ $ this ->assertEquals ('1StringWith1-dollar ' , $ result );
4189
+
4190
+ $ result = $ this ->Form ->domIdSuffix ('1 string with 1€-dollar ' , 'xhtml ' );
4191
+ $ this ->assertEquals ('1StringWith1-dollar1 ' , $ result );
4192
+
4193
+ $ result = $ this ->Form ->domIdSuffix ('1 string with 1$-dollar ' , 'xhtml ' );
4194
+ $ this ->assertEquals ('1StringWith1-dollar2 ' , $ result );
4195
+ }
4196
+
4153
4197
/**
4154
4198
* testSelect method
4155
4199
*
@@ -4998,6 +5042,84 @@ public function testSelectMultipleCheckboxes() {
4998
5042
'/div '
4999
5043
);
5000
5044
$ this ->assertTags ($ result , $ expected );
5045
+
5046
+ $ result = $ this ->Form ->select (
5047
+ 'Model.multi_field ' ,
5048
+ array ('a+ ' => 'first ' , 'a++ ' => 'second ' , 'a+++ ' => 'third ' ),
5049
+ array ('multiple ' => 'checkbox ' )
5050
+ );
5051
+ $ expected = array (
5052
+ 'input ' => array (
5053
+ 'type ' => 'hidden ' , 'name ' => 'data[Model][multi_field] ' , 'value ' => '' , 'id ' => 'ModelMultiField '
5054
+ ),
5055
+ array ('div ' => array ('class ' => 'checkbox ' )),
5056
+ array ('input ' => array (
5057
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5058
+ 'value ' => 'a+ ' , 'id ' => 'ModelMultiFieldA+ '
5059
+ )),
5060
+ array ('label ' => array ('for ' => 'ModelMultiFieldA+ ' )),
5061
+ 'first ' ,
5062
+ '/label ' ,
5063
+ '/div ' ,
5064
+ array ('div ' => array ('class ' => 'checkbox ' )),
5065
+ array ('input ' => array (
5066
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5067
+ 'value ' => 'a++ ' , 'id ' => 'ModelMultiFieldA++ '
5068
+ )),
5069
+ array ('label ' => array ('for ' => 'ModelMultiFieldA++ ' )),
5070
+ 'second ' ,
5071
+ '/label ' ,
5072
+ '/div ' ,
5073
+ array ('div ' => array ('class ' => 'checkbox ' )),
5074
+ array ('input ' => array (
5075
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5076
+ 'value ' => 'a+++ ' , 'id ' => 'ModelMultiFieldA+++ '
5077
+ )),
5078
+ array ('label ' => array ('for ' => 'ModelMultiFieldA+++ ' )),
5079
+ 'third ' ,
5080
+ '/label ' ,
5081
+ '/div '
5082
+ );
5083
+ $ this ->assertTags ($ result , $ expected );
5084
+
5085
+ $ result = $ this ->Form ->select (
5086
+ 'Model.multi_field ' ,
5087
+ array ('a>b ' => 'first ' , 'a<b ' => 'second ' , 'a"b ' => 'third ' ),
5088
+ array ('multiple ' => 'checkbox ' )
5089
+ );
5090
+ $ expected = array (
5091
+ 'input ' => array (
5092
+ 'type ' => 'hidden ' , 'name ' => 'data[Model][multi_field] ' , 'value ' => '' , 'id ' => 'ModelMultiField '
5093
+ ),
5094
+ array ('div ' => array ('class ' => 'checkbox ' )),
5095
+ array ('input ' => array (
5096
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5097
+ 'value ' => 'a>b ' , 'id ' => 'ModelMultiFieldAB2 '
5098
+ )),
5099
+ array ('label ' => array ('for ' => 'ModelMultiFieldAB2 ' )),
5100
+ 'first ' ,
5101
+ '/label ' ,
5102
+ '/div ' ,
5103
+ array ('div ' => array ('class ' => 'checkbox ' )),
5104
+ array ('input ' => array (
5105
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5106
+ 'value ' => 'a<b ' , 'id ' => 'ModelMultiFieldAB1 '
5107
+ )),
5108
+ array ('label ' => array ('for ' => 'ModelMultiFieldAB1 ' )),
5109
+ 'second ' ,
5110
+ '/label ' ,
5111
+ '/div ' ,
5112
+ array ('div ' => array ('class ' => 'checkbox ' )),
5113
+ array ('input ' => array (
5114
+ 'type ' => 'checkbox ' , 'name ' => 'data[Model][multi_field][] ' ,
5115
+ 'value ' => 'a"b ' , 'id ' => 'ModelMultiFieldAB '
5116
+ )),
5117
+ array ('label ' => array ('for ' => 'ModelMultiFieldAB ' )),
5118
+ 'third ' ,
5119
+ '/label ' ,
5120
+ '/div '
5121
+ );
5122
+ $ this ->assertTags ($ result , $ expected );
5001
5123
}
5002
5124
5003
5125
/**
0 commit comments