Skip to content

Commit e2f6683

Browse files
committed
Merge remote-tracking branch 'tier4/ACP2E-3559' into PR-Tier4-OM-2025-01-24
2 parents 3f12d15 + a27e405 commit e2f6683

File tree

7 files changed

+36
-27
lines changed

7 files changed

+36
-27
lines changed

app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2018 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
8-
98
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
109
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1110
<test name="AdminCreateVisualSwatchTest">
@@ -98,11 +97,11 @@
9897
<!-- Assert that the Save was successful after round trip to server -->
9998
<actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch1">
10099
<argument name="nthSwatch" value="1"/>
101-
<argument name="expectedStyle" value="background: rgb(231, 77, 60);"/>
100+
<argument name="expectedStyle" value="background: rgb(231, 76, 60);"/>
102101
</actionGroup>
103102
<actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch2">
104103
<argument name="nthSwatch" value="2"/>
105-
<argument name="expectedStyle" value="background: rgb(46, 204, 112);"/>
104+
<argument name="expectedStyle" value="background: rgb(46, 204, 113);"/>
106105
</actionGroup>
107106
<actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch3">
108107
<argument name="nthSwatch" value="3"/>
@@ -156,11 +155,11 @@
156155
<!-- Verify that the storefront shows the swatches too -->
157156
<actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch4">
158157
<argument name="nthSwatch" value="1"/>
159-
<argument name="expectedRgb" value="rgb(231, 77, 60)"/>
158+
<argument name="expectedRgb" value="rgb(231, 76, 60)"/>
160159
</actionGroup>
161160
<actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch5">
162161
<argument name="nthSwatch" value="2"/>
163-
<argument name="expectedRgb" value="rgb(46, 204, 112)"/>
162+
<argument name="expectedRgb" value="rgb(46, 204, 113)"/>
164163
</actionGroup>
165164
<actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatch6">
166165
<argument name="nthSwatch" value="3"/>

app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2018 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -77,7 +77,7 @@
7777
<!-- Assert that the Save was successful after round trip to server -->
7878
<actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatchAdmin">
7979
<argument name="nthSwatch" value="1"/>
80-
<argument name="expectedStyle" value="background: rgb(231, 77, 60);"/>
80+
<argument name="expectedStyle" value="background: rgb(231, 76, 60);"/>
8181
</actionGroup>
8282

8383
<!-- Create a configurable product to verify the storefront with -->
@@ -138,7 +138,7 @@
138138
<!-- Verify that the storefront shows the swatches too -->
139139
<actionGroup ref="AssertStorefrontSwatchColorActionGroup" stepKey="assertSwatchStorefront">
140140
<argument name="nthSwatch" value="1"/>
141-
<argument name="expectedRgb" value="rgb(231, 77, 60)"/>
141+
<argument name="expectedRgb" value="rgb(231, 76, 60)"/>
142142
</actionGroup>
143143

144144
<!-- Verify swatch tooltips are visible-->

app/code/Magento/Swatches/Test/Mftf/Test/AdminVisualSwatchAttributeFunctionalityTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2024 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -59,7 +59,7 @@
5959
<waitForElementVisible selector="{{AdminProductMessagesSection.successMessage}}" stepKey="waitForSuccessMessage"/>
6060
<actionGroup ref="AssertSwatchColorActionGroup" stepKey="assertSwatch1">
6161
<argument name="nthSwatch" value="2"/>
62-
<argument name="expectedStyle" value="background: rgb(231, 77, 60);"/>
62+
<argument name="expectedStyle" value="background: rgb(231, 76, 60);"/>
6363
</actionGroup>
6464
<!-- Add file swatch-->
6565
<actionGroup ref="AdminUploadFileInVisualSwatchActionGroup" stepKey="addFileSwatch">

app/code/Magento/Swatches/Test/Mftf/Test/StorefrontCustomerCanChangeProductOptionsUsingSwatchesTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2019 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -50,7 +50,7 @@
5050
<actionGroup ref="StorefrontCartPageOpenActionGroup" stepKey="openShoppingCartPage"/>
5151
<actionGroup ref="StorefrontUpdateCartConfigurableProductWithSwatchesActionGroup" stepKey="updateConfigurableProductInTheCart">
5252
<argument name="product" value="_defaultProduct"/>
53-
<argument name="productOption" value="e74d3c"/>
53+
<argument name="productOption" value="e74c3c"/>
5454
</actionGroup>
5555
</test>
5656
</tests>

app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2018 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88

@@ -105,7 +105,7 @@
105105
<grabAttributeFrom selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '1')}}" userInput="style" stepKey="grabSwatch1"/>
106106
<grabAttributeFrom selector="{{StorefrontCategorySidebarSection.attributeNthOption(ProductAttributeFrontendLabel.label, '2')}}" userInput="style" stepKey="grabSwatch2"/>
107107
<assertStringContainsString stepKey="assertSwatch1">
108-
<expectedResult type="string">rgb(231, 77, 60)</expectedResult>
108+
<expectedResult type="string">rgb(231, 76, 60)</expectedResult>
109109
<actualResult type="string">{$grabSwatch1}</actualResult>
110110
</assertStringContainsString>
111111
<assertStringContainsString stepKey="assertSwatch2">

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ lib/web/varien/js.js
1616
lib/web/jquery/jquery.validate.js
1717
lib/web/prototype/**/*.js
1818
lib/web/jquery/jstree/jquery.jstree.js
19+
lib/web/jquery/colorpicker/js/colorpicker.js
1920

2021
// MINIFIED FILES
2122
app/code/**/*.min.js

lib/web/jquery/colorpicker/js/colorpicker.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
*
33
* Color picker
44
* Author: Stefan Petre www.eyecon.ro
5-
*
5+
*
66
* Dual licensed under the MIT and GPL licenses
7-
*
7+
*
88
*/
99

1010
define([
@@ -28,6 +28,7 @@ define([
2828
livePreview: true,
2929
flat: false
3030
},
31+
HSBtoRGBCache = {},
3132
fillRGBFields = function (hsb, cal) {
3233
var rgb = HSBToRGB(hsb);
3334
$(cal).data('colorpicker').fields
@@ -115,7 +116,7 @@ define([
115116
y: ev.pageY,
116117
field: field,
117118
val: parseInt(field.val(), 10),
118-
preview: $(this).parent().parent().data('colorpicker').livePreview
119+
preview: $(this).parent().parent().data('colorpicker').livePreview
119120
};
120121
$(document).bind('mouseup', current, upIncrement);
121122
$(document).bind('mousemove', current, moveIncrement);
@@ -265,7 +266,7 @@ define([
265266
s: Math.min(100, Math.max(0, hsb.s)),
266267
b: Math.min(100, Math.max(0, hsb.b))
267268
};
268-
},
269+
},
269270
fixRGB = function (rgb) {
270271
return {
271272
r: Math.min(255, Math.max(0, rgb.r)),
@@ -284,7 +285,7 @@ define([
284285
hex = o.join('');
285286
}
286287
return hex;
287-
},
288+
},
288289
HexToRGB = function (hex) {
289290
var hex = parseInt(((hex.indexOf('#') > -1) ? hex.substring(1) : hex), 16);
290291
return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)};
@@ -303,7 +304,7 @@ define([
303304
var delta = max - min;
304305
hsb.b = max;
305306
if (max != 0) {
306-
307+
307308
}
308309
hsb.s = max != 0 ? 255 * delta / max : 0;
309310
if (hsb.s != 0) {
@@ -323,13 +324,21 @@ define([
323324
}
324325
hsb.s *= 100/255;
325326
hsb.b *= 100/255;
327+
HSBtoRGBCache[hsb.h + '|' + hsb.s + '|' + hsb.b] = {r: rgb.r, g: rgb.g, b: rgb.b};
326328
return hsb;
327329
},
328330
HSBToRGB = function (hsb) {
329331
var rgb = {};
330332
var h = Math.round(hsb.h);
331333
var s = Math.round(hsb.s*255/100);
332334
var v = Math.round(hsb.b*255/100);
335+
// Use the cached value if available to prevent precision errors during RGB to HSB and HSB to RGB conversions.
336+
// For instance: rgb(231, 76, 60) -> hsb(5.614035087719298, 74.02597402597402, 90.58823529411765) -> rgb(231, 77, 60)
337+
// produces a slightly different RGB value than the original RGB value.
338+
if (HSBtoRGBCache.hasOwnProperty(hsb.h + '|' + hsb.s + '|' + hsb.b)) {
339+
rgb = HSBtoRGBCache[hsb.h + '|' + hsb.s + '|' + hsb.b];
340+
return {r: rgb.r, g: rgb.g, b: rgb.b};
341+
}
333342
if(s == 0) {
334343
rgb.r = rgb.g = rgb.b = v;
335344
} else {
@@ -484,4 +493,4 @@ define([
484493
ColorPickerShow: ColorPicker.showPicker,
485494
ColorPickerSetColor: ColorPicker.setColor
486495
});
487-
});
496+
});

0 commit comments

Comments
 (0)