Skip to content

Commit 96e094f

Browse files
author
Mohan Ahuja
committed
ACP2E-711: "Invalid Form Key. Please refresh the page." error occurs when changing the product limit in categories
- Fixed static tests build failure
1 parent 883426f commit 96e094f

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

dev/tests/js/jasmine/tests/app/code/Magento/PageCache/frontend/js/form-key-provider.test.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ define([
1313
describe('Testing FormKey Provider', function () {
1414
var inputContainer;
1515

16+
function getFormKeyCookie() {
17+
var nameEQ = 'form_key=',
18+
cookieArr = document.cookie.split(';');
19+
20+
return cookieArr[0].split(nameEQ)[1];
21+
}
22+
1623
beforeEach(function () {
1724
inputContainer = document.createElement('input');
1825
inputContainer.setAttribute('value', '');
@@ -44,19 +51,15 @@ define([
4451
});
4552

4653
it('widget gets value from input[form_key] in case cookie is empty is pagination cache enabled', function () {
47-
document.cookie = 'form_key= ; expires = Thu, 01 Jan 1970 00:00:00 GMT';
4854
var formKey = 'TestInputStrings';
55+
56+
document.cookie = 'form_key= ; expires = Thu, 01 Jan 1970 00:00:00 GMT';
4957
$(inputContainer).val(formKey);
5058
formKeyInit({'isPaginationCacheEnabled': 1});
59+
5160
expect($(inputContainer).val()).toEqual(jasmine.any(String));
5261
expect($(inputContainer).val().length).toEqual(16);
5362
expect(formKey).toEqual(getFormKeyCookie());
5463
});
55-
56-
function getFormKeyCookie() {
57-
var nameEQ = 'form_key=',
58-
cookieArr = document.cookie.split(';');
59-
return cookieArr[0].split(nameEQ)[1];
60-
}
6164
});
6265
});

0 commit comments

Comments
 (0)