Skip to content
Snippets Groups Projects
Commit b9158165 authored by Oleksandr Miroshnichenko's avatar Oleksandr Miroshnichenko
Browse files

MAGETWO-61368: [Github]Minicart not updating after sign in #7500

parent ef033b62
Branches
No related merge requests found
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
*/ */
/* eslint max-nested-callbacks: 0 */ /* eslint max-nested-callbacks: 0 */
define(['squire'], function (Squire) { define(['squire'], function (Squire) {
'use strict'; 'use strict';
...@@ -12,7 +11,9 @@ define(['squire'], function (Squire) { ...@@ -12,7 +11,9 @@ define(['squire'], function (Squire) {
loginAction = jasmine.createSpy(), loginAction = jasmine.createSpy(),
mocks = { mocks = {
'Magento_Customer/js/action/login': loginAction, 'Magento_Customer/js/action/login': loginAction,
'Magento_Customer/js/customer-data': {get: function () {}}, 'Magento_Customer/js/customer-data': {
get: jasmine.createSpy()
},
'Magento_Customer/js/model/authentication-popup': { 'Magento_Customer/js/model/authentication-popup': {
createPopUp: jasmine.createSpy(), createPopUp: jasmine.createSpy(),
modalWindow: null modalWindow: null
...@@ -22,13 +23,13 @@ define(['squire'], function (Squire) { ...@@ -22,13 +23,13 @@ define(['squire'], function (Squire) {
}, },
obj; obj;
loginAction.registerLoginCallback = function () {}; loginAction.registerLoginCallback = jasmine.createSpy();
window.authenticationPopup = { window.authenticationPopup = {
customerRegisterUrl: 'register_url', customerRegisterUrl: 'register_url',
customerForgotPasswordUrl: 'forgot_password_url', customerForgotPasswordUrl: 'forgot_password_url',
autocomplete: 'autocomplete_flag', autocomplete: 'autocomplete_flag',
baseUrl: 'base_url' baseUrl: 'base_url'
}; };
beforeEach(function (done) { beforeEach(function (done) {
injector.mock(mocks); injector.mock(mocks);
...@@ -45,7 +46,9 @@ define(['squire'], function (Squire) { ...@@ -45,7 +46,9 @@ define(['squire'], function (Squire) {
describe('Magento_Customer/js/view/authentication-popup', function () { describe('Magento_Customer/js/view/authentication-popup', function () {
describe('"isActive" method', function () { describe('"isActive" method', function () {
it('Check for return value.', function () { it('Check for return value.', function () {
spyOn(mocks['Magento_Customer/js/customer-data'], 'get').and.returnValue(function() {return true;}); mocks['Magento_Customer/js/customer-data'].get.and.returnValue(function () {
return true;
});
expect(obj.isActive()).toBeFalsy(); expect(obj.isActive()).toBeFalsy();
}); });
}); });
...@@ -67,8 +70,11 @@ define(['squire'], function (Squire) { ...@@ -67,8 +70,11 @@ define(['squire'], function (Squire) {
currentTarget: '<form><input type="text" name="username" value="customer"/></form>', currentTarget: '<form><input type="text" name="username" value="customer"/></form>',
stopPropagation: jasmine.createSpy() stopPropagation: jasmine.createSpy()
}; };
expect(obj.login(null, event)).toBeFalsy(); expect(obj.login(null, event)).toBeFalsy();
expect(mocks['Magento_Customer/js/action/login']).toHaveBeenCalledWith({username: 'customer'}); expect(mocks['Magento_Customer/js/action/login']).toHaveBeenCalledWith({
username: 'customer'
});
}); });
}); });
}); });
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment