From 08099e4fe1e56308bc42cc639d187863088494bd Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 18 Aug 2015 19:28:45 +0200 Subject: Form: correctly set type attribute for inputs #1312 --- _test/tests/inc/form/inputelement.test.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to '_test/tests/inc/form/inputelement.test.php') 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()); + } } -- cgit v1.2.3