counter = 0; Tag::resetElementId(); } public static function provideInputHtml() { yield 'without legend' => [ [ 'format' => 'div', 'fields' => [ [ 'label' => 'Test', 'type' => 'text', ], ] ], [], '' ]; yield 'with legend' => [ [ 'format' => 'div', 'row-legend' => 'some-legend-msg', 'fields' => [ [ 'label' => 'Test', 'type' => 'text', ], ] ], [], '' ]; } public static function provideInputOOUI() { yield 'without legend' => [ [ 'fields' => [ [ 'label' => 'Test', 'type' => 'text', ], ] ], [], "" ]; yield 'with legend' => [ [ 'row-legend' => 'some-legend-msg', 'fields' => [ [ 'label' => 'Test', 'type' => 'text', ], ] ], [], "" ]; } public function testWithForm() { $descriptor = [ 'cloner' => [ 'type' => 'cloner', 'fields' => [ 'check' => [ 'type' => 'check' ], 'text' => [ 'type' => 'text', 'hide-if' => [ '===', 'check', 'value' ], ], ], ], ]; $context = new DerivativeContext( RequestContext::getMain() ); $context->setRequest( new FauxRequest( [] ) ); $form = HTMLForm::factory( 'ooui', $descriptor, $context ) ->setTitle( Title::makeTitle( NS_MAIN, 'Main Page' ) ) ->setSubmitCallback( static fn () => true ) ->setFormIdentifier( 'testform' ) ->prepareForm(); $status = $form->trySubmit(); $this->assertTrue( $status ); // HTMLFormFieldCloner would create special template fields for JS users, // make sure no warnings come from there. $form->getHTML( $status ); } }