From cf77b6e8b8dd3cd3b332153032505a24dedac0b0 Mon Sep 17 00:00:00 2001 From: Dries Date: Mon, 5 Mar 2012 07:24:51 -0500 Subject: [PATCH] - Patch #1174620 by Niklas Fiekas, Dave Reid, ericduran: Added new HTML5 FAPI element: email. --- core/modules/simpletest/tests/form.test | 4 ++-- core/modules/simpletest/tests/form_test.module | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/modules/simpletest/tests/form.test b/core/modules/simpletest/tests/form.test index 4eefff462c..d3c5907694 100644 --- a/core/modules/simpletest/tests/form.test +++ b/core/modules/simpletest/tests/form.test @@ -261,7 +261,7 @@ class FormsTestCase extends DrupalWebTestCase { // All the elements should be marked as disabled, including the ones below // the disabled container. - $this->assertEqual(count($disabled_elements), 34, t('The correct elements have the disabled property in the HTML code.')); + $this->assertEqual(count($disabled_elements), 35, 'The correct elements have the disabled property in the HTML code.'); $this->drupalPost(NULL, $edit, t('Submit')); $returned_values['hijacked'] = drupal_json_decode($this->content); @@ -396,7 +396,7 @@ class FormElementTestCase extends DrupalWebTestCase { $this->drupalGet('form-test/placeholder-text'); $expected = 'placeholder-text'; // Test to make sure non-textarea elements have the proper placeholder text. - foreach (array('textfield', 'tel', 'password') as $type) { + foreach (array('textfield', 'tel', 'password', 'email') as $type) { $element = $this->xpath('//input[@id=:id and @placeholder=:expected]', array( ':id' => 'edit-' . $type, ':expected' => $expected, diff --git a/core/modules/simpletest/tests/form_test.module b/core/modules/simpletest/tests/form_test.module index a64fb62e27..6e76badf4b 100644 --- a/core/modules/simpletest/tests/form_test.module +++ b/core/modules/simpletest/tests/form_test.module @@ -1033,7 +1033,7 @@ function form_test_select_submit($form, &$form_state) { * Builds a form to test the placeholder attribute. */ function form_test_placeholder_test($form, &$form_state) { - foreach (array('textfield', 'textarea', 'password', 'tel') as $type) { + foreach (array('textfield', 'textarea', 'password', 'tel', 'email') as $type) { $form[$type] = array( '#type' => $type, '#title' => $type, @@ -1244,6 +1244,14 @@ function _form_test_disabled_elements($form, &$form_state) { ); } + // Try to hijack the email field with a valid email. + $form['disabled_container']['disabled_container_email'] = array( + '#type' => 'email', + '#title' => 'email', + '#default_value' => 'foo@example.com', + '#test_hijack_value' => 'bar@example.com', + ); + // Text format. $form['text_format'] = array( '#type' => 'text_format', -- GitLab