Skip to content

Commit 5ca985d

Browse files
committed
Merge remote-tracking branch 'local/MC-40982' into PRodubovyk20210225
2 parents bb221b4 + cef3273 commit 5ca985d

File tree

3 files changed

+131
-0
lines changed

3 files changed

+131
-0
lines changed

app/design/frontend/Magento/blank/Magento_Theme/web/js/theme.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ define([
1717
});
1818

1919
$('.panel.header > .header.links').clone().appendTo('#store\\.links');
20+
$('#store\\.links li a').each(function () {
21+
var id = $(this).attr('id');
22+
23+
if (id !== undefined) {
24+
$(this).attr('id', id + '_mobile');
25+
}
26+
});
2027

2128
keyboardHandler.apply();
2229
});
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div class="panel header">
8+
<!-- This markup portion is the source for Mobile View Navigation Menu -->
9+
<ul class="header links">
10+
<li class="greet welcome" data-bind="scope: 'customer'">
11+
<span class="logged-in">Welcome, John Doe!</span>
12+
</li>
13+
14+
<li class="customer-welcome active">
15+
<span class="customer-name active" role="button">
16+
<button type="button" class="action switch" data-action="customer-menu-toggle">
17+
<span>Change</span>
18+
</button>
19+
</span>
20+
<!-- Markup portion for Logged in customer -->
21+
<div class="customer-menu" data-target="dropdown" aria-hidden="false">
22+
<ul class="header links">
23+
<li>
24+
<a href="http://magento.store/account/" id="my-account">My Account</a>
25+
</li>
26+
<li class="link wishlist" data-bind="scope: 'wishlist'">
27+
<a href="http://magento.store/wishlist/" id="my-wishlist">My WishList</a>
28+
</li>
29+
<li>
30+
<a href="http://magento.store/orders/" id="my-orders">My Orders</a>
31+
</li>
32+
<li>
33+
<a href="http://magento.store/addresses/" id="my-addresses">My Addresses</a>
34+
</li>
35+
<li class="link authorization-link" data-label="or">
36+
<a href="http://magento.store/customer/account/logout/">Sign Out</a>
37+
</li>
38+
</ul>
39+
</div>
40+
<li class="link authorization-link" data-label="or">
41+
<a href="http://magento.store/customer/account/logout/">Sign Out</a>
42+
</li>
43+
</li>
44+
<!-- Markup portion for Logged out customer -->
45+
<li class="link authorization-link" data-label="or">
46+
<a href="http://magento.store/customer/account/login/">Sign In</a>
47+
</li>
48+
<li>
49+
<a href="http://magento.store/customer/account/create/" id="create-account">Create an Account</a>
50+
</li>
51+
</ul>
52+
</div>
53+
54+
<div id="store.links">
55+
<!-- Navigation Menu for Mobile View will be cloned here from the source -->
56+
</div>
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
6+
/* eslint-disable max-nested-callbacks */
7+
define([
8+
'jquery',
9+
'squire',
10+
'text!tests/assets/lib/web/mage/account_menu.html'
11+
], function ($, Squire, header) {
12+
'use strict';
13+
14+
describe('Magento_Theme/js/theme', function () {
15+
var injector = new Squire(),
16+
mocks = {};
17+
18+
beforeEach(function (done) {
19+
var $menu = $(header);
20+
21+
$('body').append($menu);
22+
23+
injector.mock(mocks);
24+
injector.require(['Magento_Theme/js/theme'], function () {
25+
done();
26+
});
27+
});
28+
29+
afterEach(function () {
30+
try {
31+
injector.clean();
32+
injector.remove();
33+
header = null;
34+
} catch (e) {}
35+
});
36+
37+
it('should add suffix "_mobile" to the html ID attribute (if exists) ' +
38+
'for every menu link to make IDs unique after cloning', function () {
39+
var suffix = '_mobile',
40+
menuItems = [
41+
{
42+
id: '#my-account' + suffix,
43+
link: 'http://magento.store/account/'
44+
},
45+
{
46+
id: '#my-wishlist' + suffix,
47+
link: 'http://magento.store/wishlist/'
48+
},
49+
{
50+
id: '#my-orders' + suffix,
51+
link: 'http://magento.store/orders/'
52+
},
53+
{
54+
id: '#my-addresses' + suffix,
55+
link: 'http://magento.store/addresses/'
56+
},
57+
{
58+
id: '#create-account' + suffix,
59+
link: 'http://magento.store/customer/account/create/'
60+
}
61+
];
62+
63+
menuItems.forEach(function (item) {
64+
expect($(item.id).attr('href')).toBe(item.link);
65+
});
66+
});
67+
});
68+
});

0 commit comments

Comments
 (0)