| @@ 95-167 (lines=73) @@ | ||
| 92 | /** |
|
| 93 | * Parent should be horizontal but all children in the collection should be inline |
|
| 94 | */ |
|
| 95 | public function testChildrenNotHorizontal() |
|
| 96 | { |
|
| 97 | $view = $this->factory->createNamedBuilder('name', $this->getFormType('form'), array( |
|
| 98 | 'names' => array('name1', 'name2', 'name3'), |
|
| 99 | )) |
|
| 100 | ->add('names', $this->getFormType('collection'), array( |
|
| 101 | $this->getCollectionTypeKey() => $this->getFormType('text'), |
|
| 102 | $this->getCollectionOptionsKey() => array('horizontal' => false), |
|
| 103 | )) |
|
| 104 | ->getForm() |
|
| 105 | ->createView() |
|
| 106 | ; |
|
| 107 | ||
| 108 | $html = $this->renderWidget($view); |
|
| 109 | $this->assertMatchesXpath($this->removeBreaks($html), |
|
| 110 | ' |
|
| 111 | /fieldset |
|
| 112 | [ |
|
| 113 | ./div[@class="form-group"] |
|
| 114 | [ |
|
| 115 | ./div[@class="col-sm-9"] |
|
| 116 | [ |
|
| 117 | ./div[@class="form-group collection-items name_names_form_group"] |
|
| 118 | [ |
|
| 119 | ( |
|
| 120 | ./div[@class="collection-item"] |
|
| 121 | [ |
|
| 122 | ( |
|
| 123 | ./label[@class="required"] |
|
| 124 | ) |
|
| 125 | and |
|
| 126 | ( |
|
| 127 | ./input[@value="name1"] |
|
| 128 | ) |
|
| 129 | ] |
|
| 130 | ) |
|
| 131 | ||
| 132 | and |
|
| 133 | ||
| 134 | ( |
|
| 135 | ./div[@class="collection-item"] |
|
| 136 | [ |
|
| 137 | ( |
|
| 138 | ./label[@class="required"] |
|
| 139 | ) |
|
| 140 | and |
|
| 141 | ( |
|
| 142 | ./input[@value="name2"] |
|
| 143 | ) |
|
| 144 | ] |
|
| 145 | ) |
|
| 146 | ||
| 147 | and |
|
| 148 | ||
| 149 | ( |
|
| 150 | ./div[@class="collection-item"] |
|
| 151 | [ |
|
| 152 | ( |
|
| 153 | ./label[@class="required"] |
|
| 154 | ) |
|
| 155 | and |
|
| 156 | ( |
|
| 157 | ./input[@value="name3"] |
|
| 158 | ) |
|
| 159 | ] |
|
| 160 | ) |
|
| 161 | ] |
|
| 162 | ] |
|
| 163 | ] |
|
| 164 | ] |
|
| 165 | ' |
|
| 166 | ); |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Parent should be inline but children are horizontal |
|
| @@ 172-252 (lines=81) @@ | ||
| 169 | /** |
|
| 170 | * Parent should be inline but children are horizontal |
|
| 171 | */ |
|
| 172 | public function testChildrenHorizontal() |
|
| 173 | { |
|
| 174 | $view = $this->factory->createNamedBuilder('name', $this->getFormType('form'), array( |
|
| 175 | 'names' => array('name1', 'name2', 'name3'), |
|
| 176 | )) |
|
| 177 | ->add('names', $this->getFormType('collection'), array( |
|
| 178 | $this->getCollectionTypeKey() => $this->getFormType('text'), |
|
| 179 | $this->getCollectionOptionsKey() => array('horizontal' => true), |
|
| 180 | 'horizontal' => false, |
|
| 181 | )) |
|
| 182 | ->getForm() |
|
| 183 | ->createView() |
|
| 184 | ; |
|
| 185 | ||
| 186 | $html = $this->renderWidget($view); |
|
| 187 | $this->assertMatchesXpath($this->removeBreaks($html), |
|
| 188 | ' |
|
| 189 | /fieldset |
|
| 190 | [ |
|
| 191 | ./div[@class="form-group"] |
|
| 192 | [ |
|
| 193 | ||
| 194 | ./div[@class="form-group collection-items name_names_form_group"] |
|
| 195 | [ |
|
| 196 | ( |
|
| 197 | ./div[@class="collection-item"] |
|
| 198 | [ |
|
| 199 | ( |
|
| 200 | ./label[@class="control-label col-sm-3 required"] |
|
| 201 | ) |
|
| 202 | and |
|
| 203 | ( |
|
| 204 | ./div[@class="col-sm-9"] |
|
| 205 | [ |
|
| 206 | ./input[@value="name1"] |
|
| 207 | ] |
|
| 208 | ) |
|
| 209 | ] |
|
| 210 | ) |
|
| 211 | ||
| 212 | and |
|
| 213 | ||
| 214 | ( |
|
| 215 | ./div[@class="collection-item"] |
|
| 216 | [ |
|
| 217 | ( |
|
| 218 | ./label[@class="control-label col-sm-3 required"] |
|
| 219 | ) |
|
| 220 | and |
|
| 221 | ( |
|
| 222 | ./div[@class="col-sm-9"] |
|
| 223 | [ |
|
| 224 | ./input[@value="name2"] |
|
| 225 | ] |
|
| 226 | ) |
|
| 227 | ] |
|
| 228 | ) |
|
| 229 | ||
| 230 | and |
|
| 231 | ||
| 232 | ( |
|
| 233 | ./div[@class="collection-item"] |
|
| 234 | [ |
|
| 235 | ( |
|
| 236 | ./label[@class="control-label col-sm-3 required"] |
|
| 237 | ) |
|
| 238 | and |
|
| 239 | ( |
|
| 240 | ./div[@class="col-sm-9"] |
|
| 241 | [ |
|
| 242 | ./input[@value="name3"] |
|
| 243 | ] |
|
| 244 | ) |
|
| 245 | ] |
|
| 246 | ) |
|
| 247 | ] |
|
| 248 | ] |
|
| 249 | ] |
|
| 250 | ' |
|
| 251 | ); |
|
| 252 | } |
|
| 253 | ||
| 254 | /** |
|
| 255 | * Everything should be inline |
|
| @@ 257-326 (lines=70) @@ | ||
| 254 | /** |
|
| 255 | * Everything should be inline |
|
| 256 | */ |
|
| 257 | public function testAllNotHorizontal() |
|
| 258 | { |
|
| 259 | $view = $this->factory->createNamedBuilder('name', $this->getFormType('form'), array( |
|
| 260 | 'names' => array('name1', 'name2', 'name3'), |
|
| 261 | )) |
|
| 262 | ->add('names', $this->getFormType('collection'), array( |
|
| 263 | $this->getCollectionTypeKey() => $this->getFormType('text'), |
|
| 264 | 'horizontal' => false, |
|
| 265 | )) |
|
| 266 | ->getForm() |
|
| 267 | ->createView() |
|
| 268 | ; |
|
| 269 | ||
| 270 | $html = $this->renderWidget($view); |
|
| 271 | $this->assertMatchesXpath($this->removeBreaks($html), |
|
| 272 | ' |
|
| 273 | /fieldset |
|
| 274 | [ |
|
| 275 | ./div[@class="form-group"] |
|
| 276 | [ |
|
| 277 | ./div[@class="form-group collection-items name_names_form_group"] |
|
| 278 | [ |
|
| 279 | ( |
|
| 280 | ./div[@class="collection-item"] |
|
| 281 | [ |
|
| 282 | ( |
|
| 283 | ./label[@class="required"] |
|
| 284 | ) |
|
| 285 | and |
|
| 286 | ( |
|
| 287 | ./input[@value="name1"] |
|
| 288 | ) |
|
| 289 | ] |
|
| 290 | ) |
|
| 291 | ||
| 292 | and |
|
| 293 | ||
| 294 | ( |
|
| 295 | ./div[@class="collection-item"] |
|
| 296 | [ |
|
| 297 | ( |
|
| 298 | ./label[@class="required"] |
|
| 299 | ) |
|
| 300 | and |
|
| 301 | ( |
|
| 302 | ./input[@value="name2"] |
|
| 303 | ) |
|
| 304 | ] |
|
| 305 | ) |
|
| 306 | ||
| 307 | and |
|
| 308 | ||
| 309 | ( |
|
| 310 | ./div[@class="collection-item"] |
|
| 311 | [ |
|
| 312 | ( |
|
| 313 | ./label[@class="required"] |
|
| 314 | ) |
|
| 315 | and |
|
| 316 | ( |
|
| 317 | ./input[@value="name3"] |
|
| 318 | ) |
|
| 319 | ] |
|
| 320 | ) |
|
| 321 | ] |
|
| 322 | ] |
|
| 323 | ] |
|
| 324 | ' |
|
| 325 | ); |
|
| 326 | } |
|
| 327 | } |
|