diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-08-18 19:28:45 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-08-18 19:31:37 +0200 |
commit | 08099e4fe1e56308bc42cc639d187863088494bd (patch) | |
tree | 84a32fe9c0fd25dc2e7fe436d0c2fe36ac593468 /_test | |
parent | 2bc52ea3fb04118a428b5719c861c797f9fc0fae (diff) | |
download | rpg-08099e4fe1e56308bc42cc639d187863088494bd.tar.gz rpg-08099e4fe1e56308bc42cc639d187863088494bd.tar.bz2 |
Form: correctly set type attribute for inputs #1312
Diffstat (limited to '_test')
-rw-r--r-- | _test/tests/inc/form/checkableelement.test.php | 2 | ||||
-rw-r--r-- | _test/tests/inc/form/inputelement.test.php | 17 |
2 files changed, 19 insertions, 0 deletions
diff --git a/_test/tests/inc/form/checkableelement.test.php b/_test/tests/inc/form/checkableelement.test.php index a0e4173e8..e1491f6ec 100644 --- a/_test/tests/inc/form/checkableelement.test.php +++ b/_test/tests/inc/form/checkableelement.test.php @@ -23,6 +23,7 @@ class form_checkableelement_test extends DokuWikiTest { $this->assertEquals('second', pq($inputs->elements[1])->val()); $this->assertEquals('checked', pq($inputs->elements[0])->attr('checked')); $this->assertEquals('', pq($inputs->elements[1])->attr('checked')); + $this->assertEquals('radio', pq($inputs->elements[0])->attr('type')); } /** @@ -45,5 +46,6 @@ class form_checkableelement_test extends DokuWikiTest { $this->assertEquals('second', pq($inputs->elements[1])->val()); $this->assertEquals('', pq($inputs->elements[0])->attr('checked')); $this->assertEquals('checked', pq($inputs->elements[1])->attr('checked')); + $this->assertEquals('radio', pq($inputs->elements[0])->attr('type')); } } diff --git a/_test/tests/inc/form/inputelement.test.php b/_test/tests/inc/form/inputelement.test.php index 7a5e6d2ea..3257d2a89 100644 --- a/_test/tests/inc/form/inputelement.test.php +++ b/_test/tests/inc/form/inputelement.test.php @@ -14,6 +14,7 @@ class form_inputelement_test extends DokuWikiTest { $input = $pq->find('input[name=foo]'); $this->assertTrue($input->length == 1); $this->assertEquals('this is text', $input->val()); + $this->assertEquals('text', $input->attr('type')); $label = $pq->find('label'); $this->assertTrue($label->length == 1); @@ -38,4 +39,20 @@ class form_inputelement_test extends DokuWikiTest { $this->assertEquals('a new text', $input->val()); } + function test_password() { + $form = new Form\Form(); + $form->addPasswordInput('foo', 'label text')->val('this is text'); + + $html = $form->toHTML(); + $pq = phpQuery::newDocumentXHTML($html); + + $input = $pq->find('input[name=foo]'); + $this->assertTrue($input->length == 1); + $this->assertEquals('this is text', $input->val()); + $this->assertEquals('password', $input->attr('type')); + + $label = $pq->find('label'); + $this->assertTrue($label->length == 1); + $this->assertEquals('label text', $label->find('span')->text()); + } } |