Skip to content

Commit fa056d1

Browse files
committed
Merge remote-tracking branch 'origin/ACP2E-188' into L3_Arrows_PR_20220209
2 parents 72239c5 + 64b3939 commit fa056d1

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminFilterOrderByPurchaseDateReset">
12+
<annotations>
13+
<title value="Create Order in Admin with simple product"/>
14+
<stories value="ACP2E-188: Date picker filters are not cleared after deleting the filter in Sales Order grid"/>
15+
<description value="Search order by purchase date and clear date filter"/>
16+
<features value="Sales"/>
17+
<testCaseId value="ACP2E-188"/>
18+
<severity value="MAJOR"/>
19+
<group value="Sales"/>
20+
</annotations>
21+
<before>
22+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
23+
</before>
24+
<amOnPage url="{{AdminOrdersPage.url}}" stepKey="navigateToOrderIndexPage"/>
25+
<waitForPageLoad stepKey="waitForIndexPageLoad"/>
26+
<actionGroup ref="FilterOrderGridByPurchaseDateActionGroup" stepKey="filterOrderByPurchaseDate">
27+
<argument name="from" value="01/18/2021" />
28+
<argument name="to" value="01/18/2021" />
29+
</actionGroup>
30+
<actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilter"/>
31+
<grabValueFrom selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[from]')}}" stepKey="grabPurchasedDateFrom"/>
32+
<grabValueFrom selector="{{AdminDataGridHeaderSection.filterFieldInput('created_at[to]')}}" stepKey="grabPurchasedDateTo"/>
33+
<assertEmpty stepKey="checkPurchaseDateFromReset">
34+
<actualResult type="string">$grabPurchasedDateFrom</actualResult>
35+
</assertEmpty>
36+
<assertEmpty stepKey="checkPurchaseDateToReset">
37+
<actualResult type="string">$grabPurchasedDateTo</actualResult>
38+
</assertEmpty>
39+
<after>
40+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>
41+
</after>
42+
</test>
43+
</tests>

app/code/Magento/Ui/view/base/web/js/lib/knockout/bindings/datepicker.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ define([
2828
* For more info about options take a look at "mage/calendar" and jquery.ui.datepicker widget.
2929
* @param {HTMLElement} el - Element, that binding is applied to
3030
* @param {Function} valueAccessor - Function that returns value, passed to binding
31+
* @param {object} allBindings
32+
* @param {object} viewModel
33+
* @param {object} bindingContext
3134
*/
32-
init: function (el, valueAccessor) {
35+
init: function (el, valueAccessor, allBindings, viewModel, bindingContext) {
3336
var config = valueAccessor(),
3437
observable,
3538
options = {};
@@ -50,6 +53,16 @@ define([
5053
observable(this.value);
5154
});
5255
});
56+
57+
if (bindingContext.$data) {
58+
bindingContext.$data.value.subscribe(function (newVal) {
59+
if (!newVal) {
60+
$(el).val('');
61+
}
62+
}, this);
63+
}
64+
65+
5366
},
5467

5568
/**

0 commit comments

Comments
 (0)