summaryrefslogtreecommitdiff
path: root/_test/tests/inc/form/inputelement.test.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-08-18 19:28:45 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-08-18 19:31:37 +0200
commit08099e4fe1e56308bc42cc639d187863088494bd (patch)
tree84a32fe9c0fd25dc2e7fe436d0c2fe36ac593468 /_test/tests/inc/form/inputelement.test.php
parent2bc52ea3fb04118a428b5719c861c797f9fc0fae (diff)
downloadrpg-08099e4fe1e56308bc42cc639d187863088494bd.tar.gz
rpg-08099e4fe1e56308bc42cc639d187863088494bd.tar.bz2
Form: correctly set type attribute for inputs #1312
Diffstat (limited to '_test/tests/inc/form/inputelement.test.php')
-rw-r--r--_test/tests/inc/form/inputelement.test.php17
1 files changed, 17 insertions, 0 deletions
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());
+ }
}