Skip to content

Commit 8498721

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-57009' into 2.0-develop-pr3
2 parents b483ded + 063f66f commit 8498721

File tree

18 files changed

+469
-20
lines changed

18 files changed

+469
-20
lines changed

app/code/Magento/Bundle/view/base/web/js/price-bundle.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ define([
295295
case 'hidden':
296296
optionHash = 'bundle-option-' + optionName + '##' + optionValue;
297297
optionQty = optionConfig[optionValue].qty || 0;
298+
canQtyCustomize = optionConfig[optionValue].customQty === '1';
299+
qtyField = element.data('qtyField');
300+
qtyField.data('option', element);
301+
toggleQtyField(qtyField, optionQty, optionId, optionValue, canQtyCustomize);
298302
tempChanges = utils.deepClone(optionConfig[optionValue].prices);
299303
tempChanges = applyTierPrice(tempChanges, optionQty, optionConfig);
300304
tempChanges = applyQty(tempChanges, optionQty);

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Selection.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
<getProductName>
2929
<selector>td.col-name</selector>
3030
</getProductName>
31+
<user_defined>
32+
<selector>[class$='is-user-defined-qty']</selector>
33+
<input>checkbox</input>
34+
</user_defined>
3135
</fields>
3236
</mapping>

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
namespace Magento\Bundle\Test\Block\Catalog\Product;
88

99
use Magento\Bundle\Test\Block\Catalog\Product\View\Type\Bundle;
10-
use Magento\Bundle\Test\Fixture\BundleProduct;
10+
use Magento\Bundle\Test\Block\Catalog\Product\View\Summary;
1111
use Magento\Mtf\Client\Locator;
1212
use Magento\Mtf\Fixture\FixtureInterface;
13-
use Magento\Mtf\Fixture\InjectableFixture;
1413

1514
/**
1615
* Class View
@@ -46,6 +45,13 @@ class View extends \Magento\Catalog\Test\Block\Product\View
4645
*/
4746
protected $newsletterFormSelector = '#newsletter-validate-detail[novalidate="novalidate"]';
4847

48+
/**
49+
* Summary Block selector.
50+
*
51+
* @var string
52+
*/
53+
private $summaryBlockSelector = '#bundleSummary';
54+
4955
/**
5056
* Get bundle options block.
5157
*
@@ -59,6 +65,19 @@ public function getBundleBlock()
5965
);
6066
}
6167

68+
/**
69+
* Get bundle Summary block.
70+
*
71+
* @return Summary
72+
*/
73+
public function getBundleSummaryBlock()
74+
{
75+
return $this->blockFactory->create(
76+
Summary::class,
77+
['element' => $this->_rootElement->find($this->summaryBlockSelector)]
78+
);
79+
}
80+
6281
/**
6382
* Click "Customize and add to cart button".
6483
*
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Block\Catalog\Product\View;
8+
9+
use Magento\Bundle\Test\Block\Catalog\Product\View\Summary\ConfiguredPrice;
10+
use Magento\Catalog\Test\Block\Product\View;
11+
use Magento\Mtf\Client\ElementInterface;
12+
13+
/**
14+
* Bundle Summary block.
15+
*/
16+
class Summary extends View
17+
{
18+
/**
19+
* Configured Price block selector.
20+
*
21+
* @var string
22+
*/
23+
private $configuredPriceBlockSelector = '.price-configured_price';
24+
25+
/**
26+
* Get configured price block.
27+
*
28+
* @return ConfiguredPrice
29+
*/
30+
public function getConfiguredPriceBlock()
31+
{
32+
/** @var ElementInterface $element */
33+
$element = $this->_rootElement->find($this->configuredPriceBlockSelector);
34+
35+
return $this->blockFactory->create(
36+
ConfiguredPrice::class,
37+
['element' => $element]
38+
);
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Block\Catalog\Product\View\Summary;
8+
9+
use Magento\Catalog\Test\Block\AbstractPriceBlock;
10+
11+
/**
12+
* This class is used to access the price related information from the storefront.
13+
*/
14+
class ConfiguredPrice extends AbstractPriceBlock
15+
{
16+
/**
17+
* Mapping for different type of price.
18+
*
19+
* @var array
20+
*/
21+
protected $mapTypePrices = [
22+
'configured_price' => [
23+
'selector' => '.price',
24+
]
25+
];
26+
27+
/**
28+
* This method returns the price represented by the block.
29+
*
30+
* @param string $currency
31+
* @return string|null
32+
*/
33+
public function getPrice($currency = '$')
34+
{
35+
return $this->getTypePrice('configured_price', $currency);
36+
}
37+
}

dev/tests/functional/tests/app/Magento/Bundle/Test/Block/Catalog/Product/View/Type/Bundle.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ public function getOptions(FixtureInterface $product)
107107

108108
/** @var SimpleElement $optionElement */
109109
$optionElement = $listFormOptions[$title];
110-
$getTypeData = 'get' . $this->optionNameConvert($option['type']) . 'Data';
110+
$getTypeData = 'get' . $this->optionNameConvert($option['frontend_type']) . 'Data';
111111

112112
$optionData = $this->$getTypeData($optionElement);
113113
$optionData['title'] = $title;
114-
$optionData['type'] = $option['type'];
114+
$optionData['type'] = $option['frontend_type'];
115115
$optionData['is_require'] = $optionElement->find($this->required, Locator::SELECTOR_XPATH)->isVisible()
116116
? 'Yes'
117117
: 'No';
@@ -266,7 +266,7 @@ public function fillBundleOptions($bundleOptions)
266266
/** @var Option $optionBlock */
267267
$optionBlock = $this->blockFactory->create(
268268
'Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\\'
269-
. $this->optionNameConvert($option['type']),
269+
. $this->optionNameConvert($option['frontend_type']),
270270
['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)]
271271
);
272272
$optionBlock->fillOption($option['value']);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Element;
8+
9+
use Magento\Mtf\Client\Element\SimpleElement;
10+
11+
/**
12+
* Typified element class for qty element.
13+
*/
14+
class Qty extends SimpleElement
15+
{
16+
/**
17+
* "Backspace" key code.
18+
*/
19+
const BACKSPACE = "\xEE\x80\x83";
20+
21+
/**
22+
* "RIGHT" key code.
23+
*/
24+
const RIGHT = "\xEE\x80\x94";
25+
26+
/**
27+
* Set the value.
28+
*
29+
* @param string|array $value
30+
* @return void
31+
*/
32+
public function setValue($value)
33+
{
34+
$this->keys([self::RIGHT, self::BACKSPACE, $value]);
35+
$this->context->click();
36+
}
37+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option;
8+
9+
use Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option;
10+
11+
/**
12+
* Bundle option hidden type.
13+
*/
14+
class Hidden extends Option
15+
{
16+
//
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" ?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<mapping strict="1">
9+
<fields>
10+
<qty>
11+
<selector>//input[contains(@class,"qty")]</selector>
12+
<strategy>xpath</strategy>
13+
<class>Magento\Bundle\Test\Block\Catalog\Product\View\Type\Option\Element\Qty</class>
14+
</qty>
15+
</fields>
16+
</mapping>

dev/tests/functional/tests/app/Magento/Bundle/Test/Constraint/AssertBundleItemsOnProductPage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function prepareBundleOptions(BundleProduct $product)
6161
foreach ($bundleOptions as $optionKey => $bundleOption) {
6262
$optionData = [
6363
'title' => $bundleOption['title'],
64-
'type' => $bundleOption['type'],
64+
'type' => $bundleOption['frontend_type'],
6565
'is_require' => $bundleOption['required'],
6666
];
6767

0 commit comments

Comments
 (0)