-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
100 additions
and
0 deletions.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
dev/tests/js/jasmine/tests/lib/mage/gallery/gallery.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
define([ | ||
'mage/gallery/gallery', | ||
'jquery' | ||
], function (Gallery, $) { | ||
'use strict'; | ||
|
||
var gallery, | ||
options, | ||
element; | ||
|
||
beforeEach(function () { | ||
options = { | ||
options: { | ||
allowfullscreen: true, | ||
arrows: true, | ||
height: 700, | ||
keyboard: true, | ||
loop: true, | ||
nav: 'thumbs', | ||
navarrows: true, | ||
navdir: 'horizontal', | ||
navtype: 'slides', | ||
showCaption: false, | ||
thumbheight: 110, | ||
thumbwidth: 88, | ||
transition: 'slide', | ||
transitionduration: 500, | ||
width: 700 | ||
}, | ||
fullscreen: { | ||
arrows: true, | ||
loop: true, | ||
nav: 'thumbs', | ||
navarrows: false, | ||
navdir: 'horizontal', | ||
navtype: 'slides', | ||
showCaption: false, | ||
transition: 'slide', | ||
transitionduration: 500 | ||
}, | ||
breakpoints: { | ||
mobile: {} | ||
}, | ||
data: [ | ||
{ | ||
caption: 'Simple product', | ||
isMain: true, | ||
position: '1', | ||
type: 'image', | ||
videoUrl: null, | ||
thumb: '', | ||
full: '', | ||
img: '' | ||
} | ||
], | ||
magnifierOpts: { | ||
enabled: false, | ||
eventType: 'hover', | ||
fullscreenzoom: '20', | ||
height: 100, | ||
largeWrapper: '[data-gallery-role=\'magnifier\']', | ||
left: 10, | ||
mode: 'outside', | ||
thumb: '.fotorama__img', | ||
top: 10, | ||
width: 100, | ||
zoomable: false | ||
} | ||
}; | ||
element = $('<div class="gallery-placeholder' + | ||
' _block-content-loading" data-gallery-role="gallery-placeholder">' + | ||
'<img alt="main product photo" class="gallery-placeholder__image" src="">' + | ||
'</div>'); | ||
|
||
spyOn($.fn, 'data').and.callFake(function () { | ||
return { | ||
setOptions: jasmine.createSpy().and.returnValue(true), | ||
updateOptions: jasmine.createSpy().and.returnValue(true) | ||
}; | ||
}); | ||
expect(); | ||
gallery = new Gallery(options, element); | ||
|
||
}); | ||
|
||
describe('"initGallery" method', function () { | ||
it('Verify gallery initialization', function () { | ||
expect(gallery.settings.$elementF.class).toBe(element[1]); | ||
expect(gallery.settings.fullscreenConfig).toBeDefined(); | ||
expect(gallery.settings.fotoramaApi).toBeDefined(); | ||
expect(gallery.settings.data).toBeDefined(); | ||
expect(gallery.settings.api).toBeDefined(); | ||
}); | ||
}); | ||
}); |