diff options
Diffstat (limited to 'modules/simpletest/tests/form.test')
-rw-r--r-- | modules/simpletest/tests/form.test | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/modules/simpletest/tests/form.test b/modules/simpletest/tests/form.test index 675e8d189..620621a69 100644 --- a/modules/simpletest/tests/form.test +++ b/modules/simpletest/tests/form.test @@ -1750,3 +1750,34 @@ class FormCheckboxTestCase extends DrupalWebTestCase { } } } + +/** + * Tests uniqueness of generated HTML IDs. + */ +class HTMLIdTestCase extends DrupalWebTestCase { + + public static function getInfo() { + return array( + 'name' => 'Unique HTML IDs', + 'description' => 'Tests functionality of drupal_html_id().', + 'group' => 'Form API', + ); + } + + function setUp() { + parent::setUp('form_test'); + } + + /** + * Tests that HTML IDs do not get duplicated when form validation fails. + */ + function testHTMLId() { + $this->drupalGet('form-test/double-form'); + $this->assertNoDuplicateIds('There are no duplicate IDs'); + + // Submit second form with empty title. + $edit = array(); + $this->drupalPost(NULL, $edit, 'Save', array(), array(), 'form-test-html-id--2'); + $this->assertNoDuplicateIds('There are no duplicate IDs'); + } +} |