Skip to content

Commit fec3b64

Browse files
author
David Monllao
committed
Merge branch 'MDL-60526-33' of git://github.com/damyon/moodle into MOODLE_33_STABLE
2 parents 14120d4 + 087b392 commit fec3b64

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

lib/form/templatable_form_element.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function export_for_template(renderer_base $output) {
5151
$context = [];
5252

5353
// Not all elements have all of these attributes - but they are common enough to be valid for a few.
54-
$standardattributes = ['id', 'name', 'label', 'multiple', 'checked', 'error', 'size', 'value'];
54+
$standardattributes = ['id', 'name', 'label', 'multiple', 'checked', 'error', 'size', 'value', 'type'];
5555
$standardproperties = ['helpbutton', 'hiddenLabel'];
5656

5757
// Standard attributes.

lib/tests/formslib_test.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public function test_settype_debugging_text() {
283283
$this->assertDebuggingCalled("Did you remember to call setType() for 'texttest'? Defaulting to PARAM_RAW cleaning.");
284284

285285
// Check form still there though.
286-
$this->expectOutputRegex('/<input[^>]*name="texttest[^>]*type="text/');
286+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="texttest/');
287287
$mform->display();
288288
}
289289

@@ -303,7 +303,7 @@ public function test_settype_debugging_url() {
303303
$this->assertDebuggingCalled("Did you remember to call setType() for 'urltest'? Defaulting to PARAM_RAW cleaning.");
304304

305305
// Check form still there though.
306-
$this->expectOutputRegex('/<input[^>]*name="urltest"[^>]*type="text/');
306+
$this->expectOutputRegex('/<input[^>]*type="url[^>]*name="urltest"/');
307307
$mform->display();
308308
}
309309

@@ -312,63 +312,63 @@ public function test_settype_debugging_repeat() {
312312
$this->assertDebuggingCalled("Did you remember to call setType() for 'repeattest[0]'? Defaulting to PARAM_RAW cleaning.");
313313

314314
// Check form still there though.
315-
$this->expectOutputRegex('/<input[^>]*name="repeattest[^>]*type="text/');
315+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="repeattest/');
316316
$mform->display();
317317
}
318318

319319
public function test_settype_debugging_repeat_ok() {
320320
$mform = new formslib_settype_debugging_repeat_ok();
321321
// No debugging expected here.
322322

323-
$this->expectOutputRegex('/<input[^>]*name="repeattest[^>]*type="text/');
323+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="repeattest/');
324324
$mform->display();
325325
}
326326

327327
public function test_settype_debugging_group() {
328328
$mform = new formslib_settype_debugging_group();
329329
$this->assertDebuggingCalled("Did you remember to call setType() for 'groupel1'? Defaulting to PARAM_RAW cleaning.");
330-
$this->expectOutputRegex('/<input[^>]*name="groupel1"[^>]*type="text/');
331-
$this->expectOutputRegex('/<input[^>]*name="groupel2"[^>]*type="text/');
330+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="groupel1"/');
331+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="groupel2"/');
332332
$mform->display();
333333
}
334334

335335
public function test_settype_debugging_namedgroup() {
336336
$mform = new formslib_settype_debugging_namedgroup();
337337
$this->assertDebuggingCalled("Did you remember to call setType() for 'namedgroup[groupel1]'? Defaulting to PARAM_RAW cleaning.");
338-
$this->expectOutputRegex('/<input[^>]*name="namedgroup\[groupel1\]"[^>]*type="text/');
339-
$this->expectOutputRegex('/<input[^>]*name="namedgroup\[groupel2\]"[^>]*type="text/');
338+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="namedgroup\[groupel1\]"/');
339+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="namedgroup\[groupel2\]"/');
340340
$mform->display();
341341
}
342342

343343
public function test_settype_debugging_funky_name() {
344344
$mform = new formslib_settype_debugging_funky_name();
345345
$this->assertDebuggingCalled("Did you remember to call setType() for 'blah[foo][bar][1]'? Defaulting to PARAM_RAW cleaning.");
346-
$this->expectOutputRegex('/<input[^>]*name="blah\[foo\]\[bar\]\[0\]"[^>]*type="text/');
347-
$this->expectOutputRegex('/<input[^>]*name="blah\[foo\]\[bar\]\[1\]"[^>]*type="text/');
346+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="blah\[foo\]\[bar\]\[0\]"/');
347+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="blah\[foo\]\[bar\]\[1\]"/');
348348
$mform->display();
349349
}
350350

351351
public function test_settype_debugging_type_inheritance() {
352352
$mform = new formslib_settype_debugging_type_inheritance();
353-
$this->expectOutputRegex('/<input[^>]*name="blah\[foo\]\[bar\]\[0\]"[^>]*type="text/');
354-
$this->expectOutputRegex('/<input[^>]*name="blah\[bar\]\[foo\]\[1\]"[^>]*type="text/');
355-
$this->expectOutputRegex('/<input[^>]*name="blah\[any\]\[other\]\[2\]"[^>]*type="text/');
353+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="blah\[foo\]\[bar\]\[0\]"/');
354+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="blah\[bar\]\[foo\]\[1\]"/');
355+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="blah\[any\]\[other\]\[2\]"/');
356356
$mform->display();
357357
}
358358

359359
public function test_settype_debugging_type_group_in_repeat() {
360360
$mform = new formslib_settype_debugging_type_group_in_repeat();
361361
$this->assertDebuggingCalled("Did you remember to call setType() for 'test2[0]'? Defaulting to PARAM_RAW cleaning.");
362-
$this->expectOutputRegex('/<input[^>]*name="test1\[0\]"[^>]*type="text/');
363-
$this->expectOutputRegex('/<input[^>]*name="test2\[0\]"[^>]*type="text/');
362+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="test1\[0\]"/');
363+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="test2\[0\]"/');
364364
$mform->display();
365365
}
366366

367367
public function test_settype_debugging_type_namedgroup_in_repeat() {
368368
$mform = new formslib_settype_debugging_type_namedgroup_in_repeat();
369369
$this->assertDebuggingCalled("Did you remember to call setType() for 'namedgroup[0][test2]'? Defaulting to PARAM_RAW cleaning.");
370-
$this->expectOutputRegex('/<input[^>]*name="namedgroup\[0\]\[test1\]"[^>]*type="text/');
371-
$this->expectOutputRegex('/<input[^>]*name="namedgroup\[0\]\[test2\]"[^>]*type="text/');
370+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="namedgroup\[0\]\[test1\]"/');
371+
$this->expectOutputRegex('/<input[^>]*type="text[^>]*name="namedgroup\[0\]\[test2\]"/');
372372
$mform->display();
373373
}
374374

0 commit comments

Comments
 (0)