Skip to content

Commit 005eb2a

Browse files
author
Yaroslav Onischenko
committed
Merge remote-tracking branch 'origin/MAGETWO-51015' into develop
2 parents 925c1fb + 14735e8 commit 005eb2a

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getAllOptions($withEmpty = true, $defaultValues = false)
6666
}
6767
$options = $defaultValues ? $this->_optionsDefault[$storeId] : $this->_options[$storeId];
6868
if ($withEmpty) {
69-
array_unshift($options, ['label' => '', 'value' => '']);
69+
array_unshift($options, ['label' => $this->getAttribute()->getIsRequired() ? '' : ' ', 'value' => '']);
7070
}
7171

7272
return $options;
@@ -89,7 +89,7 @@ public function getSpecificOptions($ids, $withEmpty = true)
8989
->load()
9090
->toOptionArray();
9191
if ($withEmpty) {
92-
array_unshift($options, ['label' => '', 'value' => '']);
92+
array_unshift($options, ['label' => $this->getAttribute()->getIsRequired() ? '' : ' ', 'value' => '']);
9393
}
9494
return $options;
9595
}

app/code/Magento/Eav/Test/Unit/Model/Entity/Attribute/Source/TableTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testGetSpecificOptions($optionIds, $withEmpty)
120120

121121
$attribute = $this->getMock(
122122
'Magento\Eav\Model\Entity\Attribute\AbstractAttribute',
123-
['getId', 'getStoreId', '__wakeup'],
123+
['getId', 'getStoreId', 'getIsRequired', '__wakeup'],
124124
[],
125125
'',
126126
false
@@ -131,6 +131,9 @@ public function testGetSpecificOptions($optionIds, $withEmpty)
131131
$attribute->expects($this->once())
132132
->method('getStoreId')
133133
->willReturn($storeId);
134+
$attribute->expects($this->any())
135+
->method('getIsRequired')
136+
->willReturn(false);
134137

135138
$this->model->setAttribute($attribute);
136139

@@ -160,7 +163,7 @@ public function testGetSpecificOptions($optionIds, $withEmpty)
160163
->willReturn($options);
161164

162165
if ($withEmpty) {
163-
array_unshift($options, ['label' => '', 'value' => '']);
166+
array_unshift($options, ['label' => ' ', 'value' => '']);
164167
}
165168

166169
$this->assertEquals($options, $this->model->getSpecificOptions($optionIds, $withEmpty));

app/code/Magento/Swatches/view/adminhtml/web/js/text.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ define([
4646
data.intype = swatchOptionTextDefaultInputType;
4747
}
4848

49-
if (!this.totalItems) {
50-
data.checked = 'checked';
51-
}
5249
element = this.template({
5350
data: data
5451
});

app/code/Magento/Swatches/view/adminhtml/web/js/visual.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ define([
4949
data.intype = swatchOptionVisualDefaultInputType;
5050
}
5151

52-
if (!this.totalItems) {
53-
data.checked = 'checked';
54-
}
5552
element = this.template({
5653
data: data
5754
});

0 commit comments

Comments
 (0)