X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fhtmlform%2FHTMLFormTest.php;h=f74f60af053cdae2ce37f0ed9e3e94bc9d4d894e;hb=8624538de243da3779db5eb3362bedf78d2e2931;hp=b7e0053c72d19c9aed963d0495dca40c2013e195;hpb=500889f19005b4aed93c5b6eaafd35689fce7dcd;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/htmlform/HTMLFormTest.php b/tests/phpunit/includes/htmlform/HTMLFormTest.php index b7e0053c72..f74f60af05 100644 --- a/tests/phpunit/includes/htmlform/HTMLFormTest.php +++ b/tests/phpunit/includes/htmlform/HTMLFormTest.php @@ -1,21 +1,57 @@ setTitle( Title::newFromText( 'Foo' ) ); + return $form; + } + + public function testGetHTML_empty() { + $form = $this->newInstance(); $form->prepareForm(); $html = $form->getHTML( false ); - $this->assertRegExp( '/assertStringStartsWith( '
setTitle( Title::newFromText( 'Foo' ) ); + $form = $this->newInstance(); $form->getHTML( false ); } + + public function testAutocompleteDefaultsToNull() { + $form = $this->newInstance(); + $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) ); + } + + public function testAutocompleteWhenSetToNull() { + $form = $this->newInstance(); + $form->setAutocomplete( null ); + $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) ); + } + + public function testAutocompleteWhenSetToFalse() { + $form = $this->newInstance(); + // Previously false was used instead of null to indicate the attribute should not be set + $form->setAutocomplete( false ); + $this->assertNotContains( 'autocomplete', $form->wrapForm( '' ) ); + } + + public function testAutocompleteWhenSetToOff() { + $form = $this->newInstance(); + $form->setAutocomplete( 'off' ); + $this->assertContains( ' autocomplete="off"', $form->wrapForm( '' ) ); + } + }