Skip to content

Commit

Permalink
Merge pull request #6063 from magento-trigger/MC-30502
Browse files Browse the repository at this point in the history
[trigger] MC-30502: JSUnit tests incompatible with Node v10 or v12
  • Loading branch information
fascinosum authored Aug 31, 2020
2 parents 9bc9bd7 + 6bb128b commit e1c5c1d
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<deleteData createDataKey="category3" stepKey="deleteCategory3"/>
<deleteData createDataKey="category2" stepKey="deleteCategory2"/>
<deleteData createDataKey="category1" stepKey="deleteCategory1"/>
<actionGroup ref="CliCacheFlushActionGroup" stepKey="cleanInvalidatedCaches">
<argument name="tags" value="full_page"/>
</actionGroup>
</after>
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="amOnStorefrontPage"/>
<moveMouseOver
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<description value="Users are able to place order using Paypal Smart Button on Checkout Page, payment action is Sale"/>
<severity value="CRITICAL"/>
<testCaseId value="MC-13690"/>
<skip>
<issueId value="MC-37236"/>
</skip>
<group value="paypalExpress"/>
</annotations>
<before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<description value="Users are able to place order using Paypal Smart Button using Euro currency and merchant country is France"/>
<severity value="MAJOR"/>
<testCaseId value="MC-33274"/>
<skip>
<issueId value="MC-37236"/>
</skip>
<group value="paypalExpress"/>
</annotations>
<before>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,78 @@
/*eslint max-nested-callbacks: 0*/
define([
'jquery',
'ko',
'Magento_Ui/js/grid/masonry'
], function ($, ko, Masonry) {
], function ($, Masonry) {
'use strict';

var Component,
rows,
container = '<div data-id="masonry_grid" id="masonry_grid"><div class="masonry-image-column"></div></div>';
describe('Magento_Ui/js/grid/masonry', function () {
var Component,
rows,
container = '<div data-id="masonry_grid" id="masonry_grid"><div class="masonry-image-column"></div></div>';

beforeEach(function () {
rows = [
{
_rowIndex: 0,
category: {},
'category_id': 695,
'category_name': 'People',
'comp_url': 'https://stock.adobe.com/Rest/Libraries/Watermarked/Download/327515738/2',
'content_type': 'image/jpeg',
'country_name': 'Malaysia',
'creation_date': '2020-03-02 10:41:51',
'creator_id': 208217780,
'creator_name': 'NajmiArif',
height: 3264,
id: 327515738,
'id_field_name': 'id',
'is_downloaded': 0,
'is_licensed_locally': 0,
keywords: [],
'media_type_id': 1,
overlay: '',
path: '',
'premium_level_id': 0,
'thumbnail_240_url': 'https://t4.ftcdn.net/jpg/03/27/51/57/240_F_327515738_n.jpg',
'thumbnail_500_ur': 'https://as2.ftcdn.net/jpg/03/27/51/57/500_F_327515738_n.jpg',
title: 'Neon effect picture of man wearing medical mask for viral or pandemic disease',
width: 4896
}
beforeEach(function () {
rows = [
{
_rowIndex: 0,
category: {},
'category_id': 695,
'category_name': 'People',
'comp_url': 'url',
'content_type': 'image/jpeg',
'country_name': 'Malaysia',
'creation_date': '2020-03-02 10:41:51',
'creator_id': 208217780,
'creator_name': 'NajmiArif',
height: 3264,
id: 327515738,
'id_field_name': 'id',
'is_downloaded': 0,
'is_licensed_locally': 0,
keywords: [],
'media_type_id': 1,
overlay: '',
path: '',
'premium_level_id': 0,
'thumbnail_240_url': 'url',
'thumbnail_500_ur': 'url',
title: 'Neon effect picture of man wearing medical mask for viral or pandemic disease',
width: 4896
}
];

];

$(container).appendTo('body');

Component = new Masonry({
defaults: {
rows: ko.observable()
}
$(document.body).append(container);
Component = new Masonry({
defaults: {
containerId: '#masonry_grid'
}
});
});

});

afterEach(function () {
$('#masonry_grid').remove();
});
afterEach(function () {
Component.clear();
$('#masonry_grid').remove();
});

describe('check initComponent', function () {
it('verify setLayoutstyles called and grid iniztilized', function () {
var setlayoutStyles = spyOn(Component, 'setLayoutStyles');
describe('check initComponent', function () {
it('verify setLayoutstyles called and grid iniztilized', function () {
var setlayoutStyles = spyOn(Component, 'setLayoutStyles');

expect(Component).toBeDefined();
Component.containerId = 'masonry_grid';
Component.initComponent(rows);
Component.rows().forEach(function (image) {
expect(image.styles).toBeDefined();
expect(image.css).toBeDefined();
expect(Component).toBeDefined();
Component.containerId = 'masonry_grid';
Component.initComponent(rows);
Component.rows().forEach(function (image) {
expect(image.styles).toBeDefined();
expect(image.css).toBeDefined();
});
expect(setlayoutStyles).toHaveBeenCalled();
});
expect(setlayoutStyles).toHaveBeenCalled();
});
it('verify events triggered', function () {
var setLayoutStyles = spyOn(Component, 'setLayoutStyles');
it('verify events triggered', function () {
var setLayoutStyles = spyOn(Component, 'setLayoutStyles');

Component.initComponent(rows);
window.dispatchEvent(new Event('resize'));
expect(setLayoutStyles).toHaveBeenCalled();
Component.initComponent(rows);
window.dispatchEvent(new Event('resize'));
expect(setLayoutStyles).toHaveBeenCalled();
});
});
});
});
4 changes: 2 additions & 2 deletions package.json.sample
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"grunt-contrib-connect": "~1.0.2",
"grunt-contrib-cssmin": "~2.2.1",
"grunt-contrib-imagemin": "~2.0.1",
"grunt-contrib-jasmine": "~1.1.0",
"grunt-contrib-jasmine": "~1.2.0",
"grunt-contrib-less": "~1.4.1",
"grunt-contrib-watch": "~1.0.0",
"grunt-eslint": "~20.1.0",
Expand All @@ -39,4 +39,4 @@
"time-grunt": "~1.4.0",
"underscore": "~1.8.0"
}
}
}

0 comments on commit e1c5c1d

Please sign in to comment.