From 4fc7420feaeb082b741c45503fb8449a882adedd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 2 Dec 2016 20:19:07 +0100 Subject: [PATCH] HTMLForm: Use 'mw-htmlform' CSS class Makes it easy to identify all HTMLForms on a page. Change-Id: I5b9494fc925ac953c14b358331acddfe80c2661d --- includes/htmlform/HTMLForm.php | 3 ++- includes/htmlform/OOUIHTMLForm.php | 2 +- includes/htmlform/VFormHTMLForm.php | 2 +- resources/src/mediawiki/htmlform/styles.css | 4 ++++ tests/phpunit/includes/specials/SpecialEditWatchlistTest.php | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/includes/htmlform/HTMLForm.php b/includes/htmlform/HTMLForm.php index 71ccaa36e5..5c5a9a7eee 100644 --- a/includes/htmlform/HTMLForm.php +++ b/includes/htmlform/HTMLForm.php @@ -1047,6 +1047,7 @@ class HTMLForm extends ContextSource { : 'application/x-www-form-urlencoded'; # Attributes $attribs = [ + 'class' => 'mw-htmlform', 'action' => $this->getAction(), 'method' => $this->getMethod(), 'enctype' => $encType, @@ -1079,7 +1080,7 @@ class HTMLForm extends ContextSource { return Html::rawElement( 'form', - $this->getFormAttributes() + [ 'class' => 'visualClear' ], + $this->getFormAttributes(), $html ); } diff --git a/includes/htmlform/OOUIHTMLForm.php b/includes/htmlform/OOUIHTMLForm.php index 46b570d92f..54bdf04272 100644 --- a/includes/htmlform/OOUIHTMLForm.php +++ b/includes/htmlform/OOUIHTMLForm.php @@ -275,7 +275,7 @@ class OOUIHTMLForm extends HTMLForm { public function wrapForm( $html ) { $form = new OOUI\FormLayout( $this->getFormAttributes() + [ - 'classes' => [ 'mw-htmlform-ooui' ], + 'classes' => [ 'mw-htmlform', 'mw-htmlform-ooui' ], 'content' => new OOUI\HtmlSnippet( $html ), ] ); diff --git a/includes/htmlform/VFormHTMLForm.php b/includes/htmlform/VFormHTMLForm.php index 5d9f7a0ba2..325526bac2 100644 --- a/includes/htmlform/VFormHTMLForm.php +++ b/includes/htmlform/VFormHTMLForm.php @@ -67,7 +67,7 @@ class VFormHTMLForm extends HTMLForm { protected function getFormAttributes() { $attribs = parent::getFormAttributes(); - $attribs['class'] = [ 'mw-ui-vform', 'mw-ui-container', 'visualClear' ]; + $attribs['class'] = [ 'mw-htmlform', 'mw-ui-vform', 'mw-ui-container' ]; return $attribs; } diff --git a/resources/src/mediawiki/htmlform/styles.css b/resources/src/mediawiki/htmlform/styles.css index 1603130f40..1b9d2fb12a 100644 --- a/resources/src/mediawiki/htmlform/styles.css +++ b/resources/src/mediawiki/htmlform/styles.css @@ -1,5 +1,9 @@ /* HTMLForm styles */ +.mw-htmlform { + clear: both; +} + table.mw-htmlform-nolabel td.mw-label { display: none; } diff --git a/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php b/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php index cd84d7990f..ab3ac55324 100644 --- a/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php +++ b/tests/phpunit/includes/specials/SpecialEditWatchlistTest.php @@ -33,7 +33,7 @@ class SpecialEditWatchlistTest extends SpecialPageTestBase { $user = new TestUser( __METHOD__ ); list( $html, ) = $this->executeSpecialPage( 'clear', null, 'qqx', $user->getUser() ); $this->assertRegExp( - '/
/', + '//', $html ); } -- 2.20.1