Project

General

Profile

Feature #78999 ยป 0001-FEATURE-Add-autocomplete-attribute-to-TextfieldViewH.patch

Midhun Devasia, 2016-12-15 13:52

View differences:

typo3/sysext/fluid/Classes/ViewHelpers/Form/TextfieldViewHelper.php
$this->registerTagAttribute('size', 'int', 'The size of the input field');
$this->registerTagAttribute('placeholder', 'string', 'The placeholder of the textfield');
$this->registerTagAttribute('pattern', 'string', 'HTML5 validation pattern');
$this->registerTagAttribute('autocomplete', 'string', 'Browser should attempt to automatically complete the input based on user inputs');
$this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this view helper', false, 'f3-form-error');
$this->registerUniversalTagAttributes();
$this->registerArgument('required', 'bool', 'If the field is required or not', false, false);
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextfieldViewHelperTest.php
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$this->assertEquals($expectedResult, $actualResult);
}
/**
* @test
*/
public function renderCorrectlySetsAutocompleteAttribute()
{
$this->setArgumentsUnderTest(
$this->viewHelper,
[
'name' => 'TextfieldName',
'value' => 'TextfieldValue',
'type' => 'text',
'autocomplete' => 'off'
]
);
$this->viewHelper->setViewHelperNode(new EmptySyntaxTreeNode());
$expectedResult = '<input autocomplete="off" type="text" name="TextfieldName" value="TextfieldValue" />';
$actualResult = $this->viewHelper->initializeArgumentsAndRender();
$this->assertEquals($expectedResult, $actualResult);
}
}
    (1-1/1)