Skip to content

Commit 5bd89de

Browse files
author
Mykola Palamar
committed
MAGETWO-72181: [2.1.x] [Magento Cloud] Unable to remove custom attributes from the "Forms to Use in"
1 parent fc3f258 commit 5bd89de

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

lib/internal/Magento/Framework/Data/Test/Unit/Form/Element/MultiselectTest.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,37 @@ protected function setUp()
2626
*/
2727
public function testHiddenFieldPresentInMultiSelect()
2828
{
29-
$this->_model->setDisabled(true);
29+
$fieldName = 'fieldName';
3030
$this->_model->setCanBeEmpty(true);
31+
$this->_model->setName($fieldName);
32+
$elementHtml = $this->_model->getElementHtml();
33+
$this->assertContains('<input type="hidden" name="' . $fieldName . '"', $elementHtml);
34+
}
35+
36+
/**
37+
* Verify that hidden input is present in multiselect and it allow indicate is multiselect is disabled.
38+
*/
39+
public function testHiddenDisabledFieldPresentInMultiSelect()
40+
{
41+
$fieldName = 'fieldName';
42+
$this->_model->setDisabled(true);
43+
$this->_model->setName($fieldName);
44+
$elementHtml = $this->_model->getElementHtml();
45+
$this->assertContains('<input type="hidden" name="' . $fieldName . '_disabled"', $elementHtml);
46+
}
47+
48+
/**
49+
* Verify that hidden input doesn't present in multiselect and it allow indicate is multiselect is disabled.
50+
*
51+
* @covers \Magento\Framework\Data\Form\Element\Multiselect::getElementHtml
52+
*/
53+
public function testHiddenDisabledFieldNotPresentInMultiSelect()
54+
{
55+
$fieldName = 'fieldName';
56+
$this->_model->setDisabled(false);
57+
$this->_model->setName($fieldName);
3158
$elementHtml = $this->_model->getElementHtml();
32-
$this->assertContains('<input type="hidden"', $elementHtml);
59+
$this->assertNotContains('<input type="hidden" name="' . $fieldName . '_disabled"', $elementHtml);
3360
}
3461

3562
/**

0 commit comments

Comments
 (0)