Skip to content

Commit 81dbb94

Browse files
authored
Merge pull request #7070 from magento-trigger/AC-106
[Trigger] JQuery 3.6.x support
2 parents 1483c7a + 9df2282 commit 81dbb94

File tree

8 files changed

+610
-264
lines changed

8 files changed

+610
-264
lines changed

app/code/Magento/MediaGalleryUi/view/adminhtml/web/template/image/image-details.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h3 translate="'Details'"></h3>
3333
<each args="{ data: value, as: 'item'}">
3434
<div class="value">
3535
<a attr="href: $parents[1].getFilterUrl(item.link)"
36-
text="$parents[1].getUsedInText(item)"></a></br>
36+
text="$parents[1].getUsedInText(item)"></a><br/>
3737
</div>
3838
</each>
3939
</if>

app/code/Magento/Ui/view/base/web/js/modal/modal.js

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ define([
2424
* Detect browser transition end event.
2525
* @return {String|undefined} - transition event.
2626
*/
27-
var transitionEvent = (function () {
27+
var transitionEvent = (function () {
2828
var transition,
2929
elementStyle = document.createElement('div').style,
3030
transitions = {
@@ -39,7 +39,39 @@ define([
3939
return transitions[transition];
4040
}
4141
}
42-
})();
42+
})(),
43+
44+
/**
45+
* Implementation of zIndex used from jQuery UI
46+
* @param {Element} elem
47+
* @private
48+
*/
49+
getZIndex = function (elem) {
50+
var position, zIndex;
51+
52+
/* eslint-disable max-depth */
53+
while (elem.length && elem[ 0 ] !== document) {
54+
// Ignore z-index if position is set to a value where z-index is ignored by the browser
55+
// This makes behavior of this function consistent across browsers
56+
// WebKit always returns auto if the element is positioned
57+
position = elem.css('position');
58+
59+
if (position === 'absolute' || position === 'relative' || position === 'fixed') {
60+
// IE returns 0 when zIndex is not specified
61+
// other browsers return a string
62+
// we ignore the case of nested elements with an explicit value of 0
63+
zIndex = parseInt(elem.css('zIndex'), 10);
64+
65+
if (!isNaN(zIndex) && zIndex !== 0) {
66+
return zIndex;
67+
}
68+
}
69+
elem = elem.parent();
70+
}
71+
72+
return 0;
73+
/* eslint-enable max-depth */
74+
};
4375

4476
/**
4577
* Modal Window Widget
@@ -341,18 +373,17 @@ define([
341373
* Set z-index and margin for modal and overlay.
342374
*/
343375
_setActive: function () {
344-
var zIndex = this.modal.zIndex(),
376+
var zIndex = getZIndex(this.modal),
345377
baseIndex = zIndex + this._getVisibleCount();
346378

347379
if (this.modal.data('active')) {
348380
return;
349381
}
350-
351382
this.modal.data('active', true);
352383

353-
this.overlay.zIndex(++baseIndex);
354-
this.prevOverlayIndex = this.overlay.zIndex();
355-
this.modal.zIndex(this.overlay.zIndex() + 1);
384+
this.overlay.css('z-index', ++baseIndex);
385+
this.prevOverlayIndex = baseIndex;
386+
this.modal.css('z-index', baseIndex + 1);
356387

357388
if (this._getVisibleSlideCount()) {
358389
this.modal.css('marginLeft', this.options.modalLeftMargin * this._getVisibleSlideCount());
@@ -367,7 +398,7 @@ define([
367398
this.modal.data('active', false);
368399

369400
if (this.overlay) {
370-
this.overlay.zIndex(this.prevOverlayIndex - 1);
401+
this.overlay.css('z-index', this.prevOverlayIndex - 1);
371402
}
372403
},
373404

dev/tests/static/framework/Magento/TestFramework/CodingStandard/Tool/CodeSniffer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public function run(array $whiteList)
9999
$settings['standards'] = [$this->rulesetDir];
100100
$settings['extensions'] = $this->extensions;
101101
$settings['reports']['full'] = $this->reportFile;
102+
$settings['reportWidth'] = 120;
102103
$this->wrapper->setSettings($settings);
103104

104105
// phpcs:ignore Magento2.Functions.DiscouragedFunction

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/CodingStandard/Tool/CodeSnifferTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class CodeSnifferTest extends \PHPUnit\Framework\TestCase
2828
const RULE_SET = 'some/ruleset/directory';
2929

3030
/**
31-
* Report file
31+
* Report file path
3232
*/
3333
const REPORT_FILE = 'some/report/file.xml';
3434

@@ -52,6 +52,7 @@ public function testRun()
5252
'standards' => [self::RULE_SET],
5353
'extensions' => $extensions,
5454
'reports' => ['full' => self::REPORT_FILE],
55+
'reportWidth' => 120
5556
];
5657

5758
$this->_tool->setExtensions($extensions);

dev/tests/static/testsuite/Magento/Test/Html/LiveCodeTest.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Test\Html;
88

9+
use Magento\Framework\App\Utility\Files;
910
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer;
1011
use Magento\Test\Php\LiveCodeTest as PHPCodeTest;
1112
use Magento\TestFramework\CodingStandard\Tool\CodeSniffer\Wrapper;
@@ -46,12 +47,33 @@ public function testCodeStyle(): void
4647
$reportFile = self::$reportDir . '/html_report.txt';
4748
$codeSniffer = new CodeSniffer('Magento', $reportFile, new Wrapper());
4849
$codeSniffer->setExtensions([self::FILE_EXTENSION]);
49-
$result = $codeSniffer->run(PHPCodeTest::getWhitelist([self::FILE_EXTENSION], __DIR__, __DIR__));
50+
$fileList = $this->isFullScan() ? array_column(Files::init()->getStaticHtmlFiles(), '0')
51+
: PHPCodeTest::getWhitelist([self::FILE_EXTENSION], __DIR__, __DIR__);
52+
$result = $codeSniffer->run($fileList);
5053
$report = file_exists($reportFile) ? file_get_contents($reportFile) : '';
5154
$this->assertEquals(
5255
0,
5356
$result,
5457
"PHP Code Sniffer detected {$result} violation(s): " . PHP_EOL . $report
5558
);
5659
}
60+
61+
/**
62+
* Returns whether a full scan was requested.
63+
*
64+
* This can be set in the `phpunit.xml` used to run these test cases, by setting the constant
65+
* `TESTCODESTYLE_IS_FULL_SCAN` to `1`, e.g.:
66+
* ```xml
67+
* <php>
68+
* <!-- TESTCODESTYLE_IS_FULL_SCAN - specify if full scan should be performed for test code style test -->
69+
* <const name="TESTCODESTYLE_IS_FULL_SCAN" value="0"/>
70+
* </php>
71+
* ```
72+
*
73+
* @return bool
74+
*/
75+
private function isFullScan(): bool
76+
{
77+
return defined('TESTCODESTYLE_IS_FULL_SCAN') && TESTCODESTYLE_IS_FULL_SCAN === '1';
78+
}
5779
}

0 commit comments

Comments
 (0)