Skip to content

Commit de4dfb8

Browse files
Merge pull request #9063 from magento-gl/Hammer_248beta1_Scope03072024
[Hammer] 2.4.8-beta1 Scope
2 parents fe2e144 + 9615cef commit de4dfb8

File tree

11 files changed

+87
-37
lines changed

11 files changed

+87
-37
lines changed

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class Dob extends AbstractWidget
2323
/**
2424
* Constants for borders of date-type customer attributes
2525
*/
26-
const MIN_DATE_RANGE_KEY = 'date_range_min';
26+
public const MIN_DATE_RANGE_KEY = 'date_range_min';
2727

28-
const MAX_DATE_RANGE_KEY = 'date_range_max';
28+
public const MAX_DATE_RANGE_KEY = 'date_range_max';
2929

3030
/**
3131
* @var array
@@ -303,6 +303,7 @@ public function getHtmlExtraParams()
303303
public function getDateFormat()
304304
{
305305
$dateFormat = $this->setTwoDayPlaces($this->_localeDate->getDateFormatWithLongYear());
306+
$dateFormat = $this->setTwoMonthPlaces($dateFormat);
306307
/** Escape RTL characters which are present in some locales and corrupt formatting */
307308
$escapedDateFormat = preg_replace('/[^MmDdYy\/\.\-]/', '', $dateFormat);
308309

@@ -440,4 +441,19 @@ private function setTwoDayPlaces(string $format): string
440441
$format
441442
);
442443
}
444+
445+
/**
446+
* Set 2 places for month value in format string
447+
*
448+
* @param string $format
449+
* @return string
450+
*/
451+
private function setTwoMonthPlaces(string $format): string
452+
{
453+
return preg_replace(
454+
'/(?<!M)M(?!M)/',
455+
'MM',
456+
$format
457+
);
458+
}
443459
}

app/code/Magento/Customer/Test/Mftf/Data/DateData.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
1111
<entity name="EN_US_DATE">
1212
<data key="short">9/21/93</data>
13-
<data key="short4DigitYear">9/21/1993</data>
13+
<data key="short4DigitYear">09/21/1993</data>
1414
<data key="medium">Sep 21, 1993</data>
1515
<data key="long">September 21, 1993</data>
1616
<data key="full">Tuesday, September 21, 1993</data>

app/code/Magento/Customer/Test/Unit/Block/Widget/DobTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class DobTest extends TestCase
5252
private const YEAR = '2014';
5353

5454
// Value of date('Y', strtotime(self::DATE))
55-
private const DATE_FORMAT = 'M/dd/y';
55+
private const DATE_FORMAT = 'MM/dd/y';
5656

5757
/** Constants used by Dob::setDateInput($code, $html) */
5858
private const DAY_HTML =

dev/tests/js/jasmine/tests/app/code/Magento/Customer/frontend/js/validation.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ define([
1616

1717
dataProvider = [
1818
{
19-
format: 'M/d/Y',
19+
format: 'MM/d/Y',
2020
date: '09/2/18',
2121
expects: true
2222
},

dev/tests/static/testsuite/Magento/Test/Js/_files/blacklist/magento.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ lib/web/mage/adminhtml/varienLoader.js
1313
lib/web/magnifier/magnifier.js
1414
lib/web/magnifier/magnify.js
1515
lib/web/varien/js.js
16+
lib/web/jquery/jquery.validate.js
17+
lib/web/prototype/**/*.js
1618

1719
// MINIFIED FILES
1820
app/code/**/*.min.js
21+
lib/web/legacy-build.min.js
1922

2023
// TEST
2124
vendor/magento/magento-coding-standard/Magento2/Tests/Eslint/*

lib/internal/Magento/Framework/Amqp/Connection/Factory.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ public function create(FactoryOptions $options): AbstractConnection
3838
$parameters['ssl_options'] = $options->getSslOptions() !== null
3939
? $options->getSslOptions()
4040
: ['verify_peer' => true];
41-
return ObjectManager::getInstance()->create($connectionType, $parameters);
4241
}
43-
// need to revert the changes in scope of this ticket - AC-11673
44-
return new AMQPStreamConnection(
45-
$parameters['host'],
46-
$parameters['port'],
47-
$parameters['user'],
48-
$parameters['password'],
49-
$parameters['vhost']
50-
);
42+
return ObjectManager::getInstance()->create($connectionType, $parameters);
5143
}
5244
}

lib/internal/Magento/Framework/Amqp/Test/Unit/Connection/FactoryTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ public static function connectionDataProvider()
121121
'ssl_enabled' => true,
122122
'connection_class' => AMQPSSLConnection::class,
123123
],
124-
// [ // Need to revert in scope of this ticket - AC-11673
125-
// 'ssl_enabled' => false,
126-
// 'connection_class' => AMQPStreamConnection::class,
127-
// ],
124+
[
125+
'ssl_enabled' => false,
126+
'connection_class' => AMQPStreamConnection::class,
127+
],
128128
];
129129
}
130130

lib/web/jquery/jquery.validate.js

Lines changed: 53 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/*!
2-
* jQuery Validation Plugin v1.19.5
2+
* jQuery Validation Plugin v1.20.0
33
*
44
* https://jqueryvalidation.org/
55
*
6-
* Copyright (c) 2022 Jörn Zaefferer
6+
* Copyright (c) 2023 Jörn Zaefferer
77
* Released under the MIT license
88
*/
99
(function( factory ) {
@@ -775,6 +775,9 @@
775775
val = this.elementValue( element ),
776776
result, method, rule, normalizer;
777777

778+
// Abort any pending Ajax request from a previous call to this method.
779+
this.abortRequest( element );
780+
778781
// Prioritize the local normalizer defined for this element over the global one
779782
// if the former exists, otherwise user the global one in case it exists.
780783
if ( typeof rules.normalizer === "function" ) {
@@ -961,14 +964,23 @@
961964
error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
962965

963966
// Replace message on existing label
964-
error.html( message );
967+
if ( this.settings && this.settings.escapeHtml ) {
968+
error.text( message || "" );
969+
} else {
970+
error.html( message || "" );
971+
}
965972
} else {
966973

967974
// Create error element
968975
error = $( "<" + this.settings.errorElement + ">" )
969976
.attr( "id", elementID + "-error" )
970-
.addClass( this.settings.errorClass )
971-
.html( message || "" );
977+
.addClass( this.settings.errorClass );
978+
979+
if ( this.settings && this.settings.escapeHtml ) {
980+
error.text( message || "" );
981+
} else {
982+
error.html( message || "" );
983+
}
972984

973985
// Maintain reference to the element to be placed into the DOM
974986
place = error;
@@ -1039,7 +1051,7 @@
10391051
// 'aria-describedby' should directly reference the error element
10401052
if ( describer ) {
10411053
selector = selector + ", #" + this.escapeCssMeta( describer )
1042-
.replace( /\s+/g, ", #" ) + ":visible";
1054+
.replace( /\s+/g, ", #" );
10431055
}
10441056

10451057
return this
@@ -1114,6 +1126,10 @@
11141126
return !$.validator.methods.required.call( this, val, element ) && "dependency-mismatch";
11151127
},
11161128

1129+
elementAjaxPort: function( element ) {
1130+
return "validate" + element.name;
1131+
},
1132+
11171133
startRequest: function( element ) {
11181134
if ( !this.pending[ element.name ] ) {
11191135
this.pendingRequest++;
@@ -1149,6 +1165,25 @@
11491165
}
11501166
},
11511167

1168+
abortRequest: function( element ) {
1169+
var port;
1170+
1171+
if ( this.pending[ element.name ] ) {
1172+
port = this.elementAjaxPort( element );
1173+
$.ajaxAbort( port );
1174+
1175+
this.pendingRequest--;
1176+
1177+
// Sometimes synchronization fails, make sure pendingRequest is never < 0
1178+
if ( this.pendingRequest < 0 ) {
1179+
this.pendingRequest = 0;
1180+
}
1181+
1182+
delete this.pending[ element.name ];
1183+
$( element ).removeClass( this.settings.pendingClass );
1184+
}
1185+
},
1186+
11521187
previousValue: function( element, method ) {
11531188
method = typeof method === "string" && method || "remote";
11541189

@@ -1600,7 +1635,7 @@
16001635
data[ element.name ] = value;
16011636
$.ajax( $.extend( true, {
16021637
mode: "abort",
1603-
port: "validate" + element.name,
1638+
port: this.elementAjaxPort( element ),
16041639
dataType: "json",
16051640
data: data,
16061641
context: validator.currentForm,
@@ -1611,7 +1646,6 @@
16111646
validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
16121647
if ( valid ) {
16131648
submitted = validator.formSubmitted;
1614-
validator.resetInternals();
16151649
validator.toHide = validator.errorsFor( element );
16161650
validator.formSubmitted = submitted;
16171651
validator.successList.push( element );
@@ -1636,6 +1670,7 @@
16361670

16371671
// Ajax mode: abort
16381672
// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
1673+
// $.ajaxAbort( port );
16391674
// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
16401675

16411676
var pendingRequests = {},
@@ -1646,9 +1681,7 @@
16461681
$.ajaxPrefilter( function( settings, _, xhr ) {
16471682
var port = settings.port;
16481683
if ( settings.mode === "abort" ) {
1649-
if ( pendingRequests[ port ] ) {
1650-
pendingRequests[ port ].abort();
1651-
}
1684+
$.ajaxAbort( port );
16521685
pendingRequests[ port ] = xhr;
16531686
}
16541687
} );
@@ -1660,14 +1693,20 @@
16601693
var mode = ( "mode" in settings ? settings : $.ajaxSettings ).mode,
16611694
port = ( "port" in settings ? settings : $.ajaxSettings ).port;
16621695
if ( mode === "abort" ) {
1663-
if ( pendingRequests[ port ] ) {
1664-
pendingRequests[ port ].abort();
1665-
}
1696+
$.ajaxAbort( port );
16661697
pendingRequests[ port ] = ajax.apply( this, arguments );
16671698
return pendingRequests[ port ];
16681699
}
16691700
return ajax.apply( this, arguments );
16701701
};
16711702
}
1703+
1704+
// Abort the previous request without sending a new one
1705+
$.ajaxAbort = function( port ) {
1706+
if ( pendingRequests[ port ] ) {
1707+
pendingRequests[ port ].abort();
1708+
delete pendingRequests[ port ];
1709+
}
1710+
};
16721711
return $;
16731712
}));

lib/web/legacy-build.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/moment.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/web/prototype/prototype.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ Object.extend(String.prototype, (function () {
643643
}
644644

645645
function stripTags() {
646-
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?(\/)?>|<\/\w+>/gi, '');
646+
return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>'"])+)?\s*("[^">]*|'[^'>])?(\/)?>|<\/\w+>/gi, '');
647647
}
648648

649649
function stripScripts() {

0 commit comments

Comments
 (0)