Skip to content

Commit c509eb9

Browse files
authored
ENGCOM-6966: Fixed issue 25910 choose drop down not close when open another #26090
2 parents 976d045 + cacdfaf commit c509eb9

File tree

3 files changed

+46
-2
lines changed

3 files changed

+46
-2
lines changed

app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
<element name="nthSwatchText" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(3) input" parameterized="true"/>
1818
<element name="nthIsDefault" type="input" selector="(//input[@name='defaultvisual[]'])[{{var}}]" parameterized="true"/>
1919
<element name="nthSwatchAdminDescription" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(4) input" parameterized="true"/>
20+
<element name="nthVisualSwatch" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatches-visual-col" parameterized="true"/>
21+
<element name="chooserBlock" type="block" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatches-visual-col .swatch_sub-menu_container" parameterized="true"/>
2022
<!-- Selector for Admin Description input where the index is zero-based -->
2123
<element name="swatchAdminDescriptionByIndex" type="input" selector="input[name='optiontext[value][option_{{index}}][0]']" parameterized="true"/>
2224
<element name="nthChooseColor" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.colorpicker_handler" parameterized="true"/>
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCheckColorUploadChooserVisualSwatchTest">
11+
<annotations>
12+
<features value="Swatches"/>
13+
<stories value="Check correct view of visual swatches"/>
14+
<title value="Correct view of Swatches while choosing color or upload image"/>
15+
<description value="Correct view of Swatches while choosing color or upload image"/>
16+
<severity value="AVERAGE"/>
17+
<group value="Swatches"/>
18+
</annotations>
19+
<before>
20+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
21+
</before>
22+
<amOnPage url="{{ProductAttributePage.url}}" stepKey="addNewProductAttribute"/>
23+
<selectOption selector="{{AttributePropertiesSection.InputType}}"
24+
userInput="{{visualSwatchAttribute.input_type}}" stepKey="fillInputType"/>
25+
26+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/>
27+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/>
28+
<click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/>
29+
<click selector="{{AdminManageSwatchSection.nthVisualSwatch('3')}}" stepKey="clickSwatch3"/>
30+
31+
<click selector="{{AdminManageSwatchSection.nthVisualSwatch('2')}}" stepKey="clickSwatch2"/>
32+
<seeElement selector="{{AdminManageSwatchSection.chooserBlock('2')}}" stepKey="seeSwatch2"/>
33+
<dontSeeElement selector="{{AdminManageSwatchSection.chooserBlock('3')}}" stepKey="dontSeeSwatch3"/>
34+
35+
<click selector="{{AdminManageSwatchSection.nthVisualSwatch('1')}}" stepKey="clickSwatch1"/>
36+
<seeElement selector="{{AdminManageSwatchSection.chooserBlock('1')}}" stepKey="seeSwatch1"/>
37+
<dontSeeElement selector="{{AdminManageSwatchSection.chooserBlock('2')}}" stepKey="dontSeeSwatch2"/>
38+
</test>
39+
</tests>

app/code/Magento/Swatches/view/adminhtml/web/js/visual.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,11 @@ define([
404404
/**
405405
* Toggle color upload chooser
406406
*/
407-
$(document).on('click', '.swatch_window', function () {
408-
$(this).next('div').toggle();
407+
$(document).on('click', '.swatches-visual-col', function () {
408+
var currentElement = $(this).find('.swatch_sub-menu_container');
409+
410+
jQuery('.swatch_sub-menu_container').not(currentElement).hide();
411+
currentElement.toggle();
409412
});
410413
});
411414
};

0 commit comments

Comments
 (0)