Commit 433e3b05 authored by Carsten  Rose's avatar Carsten Rose
Browse files

BuildFormPlainTest.php: unit tests adjusted for new behaviour of maxLength...

BuildFormPlainTest.php: unit tests adjusted for new behaviour of maxLength /size for columns which are not defined in primary table.
parent 14365a7f
......@@ -146,6 +146,32 @@ class BuildFormPlainTest extends AbstractDatabaseTest {
$this->assertEquals('<input name="name:1" class="form-control" type="input" size="40" maxlength="255" value="" data-hidden="no" data-disabled="no" data-required="no" ><div class="help-block with-errors"></div>', $result);
$this->assertEquals([FE_MODE_HIDDEN => '', 'disabled' => false, FE_MODE_REQUIRED => '', 'form-element' => 'name:1', 'value' => '', 'disabled' => false], $json);
// no size, no maxlength and column not in primary table
$formElement2 = $formElement;
$formElement2['maxLength'] = '';
$formElement2['size'] = '';
$formElement2['name'] = 'specialname';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input name="specialname:1" class="form-control" type="input" value="" data-hidden="no" data-disabled="no" data-required="no" ><div class="help-block with-errors"></div>', $result);
// no size, given maxlength and column not in primary table
$formElement2['maxLength'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input name="specialname:1" class="form-control" type="input" maxlength="10" value="" data-hidden="no" data-disabled="no" data-required="no" ><div class="help-block with-errors"></div>', $result);
// size given, no maxlength and column not in primary table
$formElement2['maxLength'] = '';
$formElement2['size'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input name="specialname:1" class="form-control" type="input" size="10" value="" data-hidden="no" data-disabled="no" data-required="no" ><div class="help-block with-errors"></div>', $result);
// size given, maxlength given and column not in primary table
$formElement2['maxLength'] = '20';
$formElement2['size'] = '10';
$result = $build->buildInput($formElement2, 'specialname:1', '', $json);
$this->assertEquals('<input name="specialname:1" class="form-control" type="input" size="10" maxlength="20" value="" data-hidden="no" data-disabled="no" data-required="no" ><div class="help-block with-errors"></div>', $result);
// Explicit: further
$formElement['tooltip'] = 'Nice Tooltip';
$formElement['placeholder'] = 'Please type a name';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment