If you have a form with an html5 type for one of it's fields, for instance the very useful "type='email'", trying to assert the presence of the field (and presumably set it) fails. This is different behavior from pretty much all browsers, which at least recognize such fields at type=text, even if they don't implement html5, and degrade gracefully.
Example html page to test:
<html>
<body>
<form action='' method='get' name='whatever'>
<input type='email'>
<input type='submit' value='submit'>
</form>
</body>
</html>
example test case:
class TestHtml5 extends WebTestCase {
function testThatHtml5EmailFieldIsDetected(){
$this->get(BASE_URL.'simpletesttest.html');
$this->assertField('email');
}
}
?>
I tried the patch below, but it didn't have the intended effect for some reason.
diff --git a/tag.php b/tag.php
index e7e954c..99062a3 100644
--- a/tag.php
+++ b/tag.php
@@ -83,6 +83,17 @@ class SimpleTagBuilder {
'checkbox' => 'SimpleCheckboxTag',
'radio' => 'SimpleRadioButtonTag',
'text' => 'SimpleTextTag',
+ 'email' => 'SimpleTextTag',
+ 'url' => 'SimpleTextTag',
+ 'search' => 'SimpleTextTag',
+ 'number' => 'SimpleTextTag',
+ 'color' => 'SimpleTextTag',
+ 'datetime' => 'SimpleTextTag',
+ 'datetime-local' => 'SimpleTextTag',
+ 'date' => 'SimpleTextTag',
+ 'month' => 'SimpleTextTag',
+ 'week' => 'SimpleTextTag',
+ 'time' => 'SimpleTextTag',
'hidden' => 'SimpleTextTag',
'password' => 'SimpleTextTag',
'file' => 'SimpleUploadTag');
@@ -90,6 +101,7 @@ class SimpleTagBuilder {
$tag_class = $map[$type];
return new $tag_class($attributes);
}
return false;
}