Skip to content

Commit b5b1a66

Browse files
authored
Merge pull request #701 from magento-folks/bugs
Bug fixes: * MAGETWO-61358: Wrong Path of Target csv Files (csv::class typo) * MAGETWO-61368: [Github]Minicart not updating after sign in #7500 * MAGETWO-61092: Error css in customer account with Toolbar-amount and mobile design #7437 Tasks: * MAGETWO-61261: Cover with Js unit test changes introduced in the scope of bugfixing
2 parents c429316 + fe48f0c commit b5b1a66

File tree

18 files changed

+758
-23
lines changed

18 files changed

+758
-23
lines changed

app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ define(
242242
emailValidationResult = customer.isLoggedIn();
243243

244244
if (!quote.shippingMethod()) {
245-
this.errorValidationMessage($.mage.__('Please specify a shipping method.'));
245+
this.errorValidationMessage($t('Please specify a shipping method.'));
246246

247247
return false;
248248
}

app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,24 @@ define(
6969
},
7070

7171
/** Provide login action */
72-
login: function (loginForm) {
72+
login: function (formUiElement, event) {
7373
var loginData = {},
74-
formDataArray = $(loginForm).serializeArray();
74+
formElement = $(event.currentTarget),
75+
formDataArray = formElement.serializeArray();
76+
77+
event.stopPropagation();
7578
formDataArray.forEach(function (entry) {
7679
loginData[entry.name] = entry.value;
7780
});
7881

79-
if ($(loginForm).validation() &&
80-
$(loginForm).validation('isValid')
82+
if (formElement.validation() &&
83+
formElement.validation('isValid')
8184
) {
8285
this.isLoading(true);
83-
loginAction(loginData, null, false);
86+
loginAction(loginData);
8487
}
88+
89+
return false;
8590
}
8691
});
8792
}

app/code/Magento/Customer/view/frontend/web/template/authentication-popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<div class="block-content" aria-labelledby="block-customer-login-heading">
5151
<form class="form form-login"
5252
method="post"
53-
data-bind="submit:login"
53+
data-bind="event: {submit: login }"
5454
id="login-form">
5555
<div class="fieldset login" data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
5656
<div class="field email required">

app/code/Magento/Search/Controller/Adminhtml/Term/ExportSearchCsv.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ public function execute()
4040
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
4141
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
4242
$content = $resultLayout->getLayout()->getChildBlock('adminhtml.report.search.grid', 'grid.export');
43-
return $this->fileFactory->create(\search.csv::class, $content->getCsvFile(), DirectoryList::VAR_DIR);
43+
return $this->fileFactory->create('search.csv', $content->getCsvFile(), DirectoryList::VAR_DIR);
4444
}
4545
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Search\Test\Unit\Controller\Adminhtml\Term;
7+
8+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
9+
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Framework\App\Filesystem\DirectoryList;
11+
12+
class ExportSearchCsvTest extends \PHPUnit_Framework_TestCase
13+
{
14+
/**
15+
* @var \Magento\TaxImportExport\Controller\Adminhtml\Rate\ExportPost
16+
*/
17+
private $controller;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject
21+
*/
22+
private $fileFactoryMock;
23+
24+
/**
25+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
26+
*/
27+
private $objectManagerHelper;
28+
29+
/**
30+
* @var \PHPUnit_Framework_MockObject_MockObject
31+
*/
32+
private $resultFactoryMock;
33+
34+
protected function setUp()
35+
{
36+
$this->objectManagerHelper = new ObjectManagerHelper($this);
37+
$this->fileFactoryMock = $this->getMock(
38+
\Magento\Framework\App\Response\Http\FileFactory::class,
39+
[],
40+
[],
41+
'',
42+
false
43+
);
44+
$this->resultFactoryMock = $this->getMock(
45+
\Magento\Framework\Controller\ResultFactory::class,
46+
[],
47+
[],
48+
'',
49+
false
50+
);
51+
52+
$this->controller = $this->objectManagerHelper->getObject(
53+
\Magento\Search\Controller\Adminhtml\Term\ExportSearchCsv::class,
54+
[
55+
'fileFactory' => $this->fileFactoryMock,
56+
'resultFactory' => $this->resultFactoryMock
57+
]
58+
);
59+
}
60+
61+
public function testExecute()
62+
{
63+
$resultLayoutMock = $this->getMock(\Magento\Framework\View\Result\Layout::class, [], [], '', false);
64+
$layoutMock = $this->getMock(\Magento\Framework\View\LayoutInterface::class);
65+
$contentMock = $this->getMock(
66+
\Magento\Framework\View\Element\AbstractBlock::class,
67+
['getCsvFile'],
68+
[],
69+
'',
70+
false
71+
);
72+
$this->resultFactoryMock
73+
->expects($this->once())
74+
->method('create')
75+
->with(ResultFactory::TYPE_LAYOUT)->willReturn($resultLayoutMock);
76+
$resultLayoutMock->expects($this->once())->method('getLayout')->willReturn($layoutMock);
77+
$layoutMock->expects($this->once())->method('getChildBlock')->willReturn($contentMock);
78+
$contentMock->expects($this->once())->method('getCsvFile')->willReturn('csvFile');
79+
$this->fileFactoryMock
80+
->expects($this->once())
81+
->method('create')
82+
->with('search.csv', 'csvFile', DirectoryList::VAR_DIR);
83+
$this->controller->execute();
84+
}
85+
}

app/code/Magento/TaxImportExport/Controller/Adminhtml/Rate/ExportPost.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function execute()
8181

8282
$content .= $rate->toString($template) . "\n";
8383
}
84-
return $this->fileFactory->create(\tax_rates.csv::class, $content, DirectoryList::VAR_DIR);
84+
return $this->fileFactory->create('tax_rates.csv', $content, DirectoryList::VAR_DIR);
8585
}
8686

8787
/**
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\TaxImportExport\Test\Unit\Controller\Adminhtml\Rate;
8+
9+
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
10+
use Magento\Framework\App\Filesystem\DirectoryList;
11+
12+
class ExportPostTest extends \PHPUnit_Framework_TestCase
13+
{
14+
/**
15+
* @var \Magento\TaxImportExport\Controller\Adminhtml\Rate\ExportPost
16+
*/
17+
private $controller;
18+
19+
/**
20+
* @var \PHPUnit_Framework_MockObject_MockObject
21+
*/
22+
private $fileFactoryMock;
23+
24+
/**
25+
* @var \PHPUnit_Framework_MockObject_MockObject
26+
*/
27+
private $objectManagerMock;
28+
29+
/**
30+
* @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
31+
*/
32+
private $objectManagerHelper;
33+
34+
protected function setUp()
35+
{
36+
$this->objectManagerHelper = new ObjectManagerHelper($this);
37+
$this->fileFactoryMock = $this->getMock(
38+
\Magento\Framework\App\Response\Http\FileFactory::class,
39+
[],
40+
[],
41+
'',
42+
false
43+
);
44+
$this->objectManagerMock = $this->getMock(\Magento\Framework\ObjectManagerInterface::class);
45+
$this->controller = $this->objectManagerHelper->getObject(
46+
\Magento\TaxImportExport\Controller\Adminhtml\Rate\ExportPost::class,
47+
[
48+
'fileFactory' => $this->fileFactoryMock,
49+
'objectManager' => $this->objectManagerMock
50+
]
51+
);
52+
}
53+
54+
public function testExecute()
55+
{
56+
$headers = new \Magento\Framework\DataObject(
57+
[
58+
'code' => __('Code'),
59+
'country_name' => __('Country'),
60+
'region_name' => __('State'),
61+
'tax_postcode' => __('Zip/Post Code'),
62+
'rate' => __('Rate'),
63+
'zip_is_range' => __('Zip/Post is Range'),
64+
'zip_from' => __('Range From'),
65+
'zip_to' => __('Range To'),
66+
]
67+
);
68+
$template = '"{{code}}","{{country_name}}","{{region_name}}","{{tax_postcode}}","{{rate}}"' .
69+
',"{{zip_is_range}}","{{zip_from}}","{{zip_to}}"';
70+
$content = $headers->toString($template);
71+
$content .= "\n";
72+
$storeMock = $this->getMock(\Magento\Store\Model\Store::class, [], [], '', false);
73+
$storeCollectionMock = $this->objectManagerHelper->getCollectionMock(
74+
\Magento\Store\Model\ResourceModel\Store\Collection::class,
75+
[]
76+
);
77+
$rateCollectionMock = $this->objectManagerHelper->getCollectionMock(
78+
\Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection::class,
79+
[]
80+
);
81+
82+
$taxCollectionMock = $this->objectManagerHelper->getCollectionMock(
83+
\Magento\Tax\Model\ResourceModel\Calculation\Rate\Title\Collection::class,
84+
[]
85+
);
86+
$storeCollectionMock->expects($this->once())->method('setLoadDefault')->willReturnSelf();
87+
$rateTitleMock = $this->getMock(\Magento\Tax\Model\Calculation\Rate\Title::class, [], [], '', false);
88+
$rateTitleMock->expects($this->once())->method('getCollection')->willReturn($taxCollectionMock);
89+
$storeMock->expects($this->once())->method('getCollection')->willReturn($storeCollectionMock);
90+
$this->objectManagerMock->expects($this->any())->method('create')->willReturnMap([
91+
[\Magento\Store\Model\Store::class, [], $storeMock],
92+
[\Magento\Tax\Model\Calculation\Rate\Title::class, [], $rateTitleMock],
93+
[\Magento\Tax\Model\ResourceModel\Calculation\Rate\Collection::class, [], $rateCollectionMock]
94+
]);
95+
$rateCollectionMock->expects($this->once())->method('joinCountryTable')->willReturnSelf();
96+
$rateCollectionMock->expects($this->once())->method('joinRegionTable')->willReturnSelf();
97+
$this->fileFactoryMock
98+
->expects($this->once())
99+
->method('create')
100+
->with('tax_rates.csv', $content, DirectoryList::VAR_DIR);
101+
$this->controller->execute();
102+
}
103+
}

app/design/frontend/Magento/luma/Magento_Customer/web/css/source/_module.less

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,11 @@
319319

320320
.order-products-toolbar {
321321
position: relative;
322+
323+
.toolbar-amount {
324+
position: relative;
325+
text-align: center;
326+
}
322327
}
323328
}
324329

app/design/frontend/Magento/luma/Magento_Review/web/css/source/_module.less

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,27 @@
4040

4141
.review-control-vote {
4242
.lib-rating-vote();
43+
4344
&:before {
4445
.lib-rating-icons-content(
4546
@_icon-content: @icon-star-empty
4647
);
4748
}
4849
}
4950

51+
//
52+
// Account Review list page
53+
// -----------------------------------------
54+
55+
.products-reviews-toolbar {
56+
position: relative;
57+
58+
.toolbar-amount {
59+
position: relative;
60+
text-align: center;
61+
}
62+
}
63+
5064
//
5165
// Review product page
5266
// -----------------------------------------
@@ -95,6 +109,7 @@
95109
.fieldset &-legend.legend {
96110
border-bottom: 0;
97111
line-height: 1.3;
112+
margin-bottom: @indent__base;
98113
padding: 0;
99114

100115
span {
@@ -105,8 +120,6 @@
105120
display: block;
106121
font-weight: 600;
107122
}
108-
109-
margin-bottom: @indent__base;
110123
}
111124

112125
.fieldset &-field-ratings {
@@ -189,6 +202,7 @@
189202
margin-bottom: @indent__base;
190203
}
191204
}
205+
192206
.page-main {
193207
.column {
194208
.review-add {
@@ -284,9 +298,6 @@
284298
a:not(:last-child) {
285299
margin-right: 30px;
286300
}
287-
288-
.action.view span {
289-
}
290301
}
291302
}
292303

@@ -331,6 +342,7 @@
331342
.items {
332343
.item {
333344
.lib-css(margin-bottom, @indent__base);
345+
334346
&:last-child {
335347
margin-bottom: 0;
336348
}
@@ -339,6 +351,7 @@
339351

340352
.product-name {
341353
display: inline-block;
354+
342355
&:not(:last-child) {
343356
.lib-css(margin-bottom, @indent__xs);
344357
}
@@ -415,9 +428,6 @@
415428
width: 30%;
416429
}
417430

418-
.product-info {
419-
}
420-
421431
.review-details {
422432
margin: 0;
423433

dev/tests/js/jasmine/require.conf.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ require.config({
1616
]
1717
},
1818
paths: {
19-
'tests': 'dev/tests/js/jasmine'
19+
'tests': 'dev/tests/js/jasmine',
20+
'squire': 'node_modules/squirejs/src/Squire'
21+
},
22+
shim: {
23+
squire: {
24+
exports: 'squire'
25+
}
2026
},
2127
config: {
2228
jsbuild: {

0 commit comments

Comments
 (0)