|
| 1 | +/** |
| 2 | + * Copyright © Magento, Inc. All rights reserved. |
| 3 | + * See COPYING.txt for license details. |
| 4 | + */ |
| 5 | + |
| 6 | +define([ |
| 7 | + 'mage/gallery/gallery', |
| 8 | + 'jquery' |
| 9 | +], function (Gallery, $) { |
| 10 | + 'use strict'; |
| 11 | + |
| 12 | + var gallery, |
| 13 | + options, |
| 14 | + element; |
| 15 | + |
| 16 | + beforeEach(function () { |
| 17 | + options = { |
| 18 | + options: { |
| 19 | + allowfullscreen: true, |
| 20 | + arrows: true, |
| 21 | + height: 700, |
| 22 | + keyboard: true, |
| 23 | + loop: true, |
| 24 | + nav: 'thumbs', |
| 25 | + navarrows: true, |
| 26 | + navdir: 'horizontal', |
| 27 | + navtype: 'slides', |
| 28 | + showCaption: false, |
| 29 | + thumbheight: 110, |
| 30 | + thumbwidth: 88, |
| 31 | + transition: 'slide', |
| 32 | + transitionduration: 500, |
| 33 | + width: 700 |
| 34 | + }, |
| 35 | + fullscreen: { |
| 36 | + arrows: true, |
| 37 | + loop: true, |
| 38 | + nav: 'thumbs', |
| 39 | + navarrows: false, |
| 40 | + navdir: 'horizontal', |
| 41 | + navtype: 'slides', |
| 42 | + showCaption: false, |
| 43 | + transition: 'slide', |
| 44 | + transitionduration: 500 |
| 45 | + }, |
| 46 | + breakpoints: { |
| 47 | + mobile: {} |
| 48 | + }, |
| 49 | + data: [ |
| 50 | + { |
| 51 | + caption: 'Simple product', |
| 52 | + isMain: true, |
| 53 | + position: '1', |
| 54 | + type: 'image', |
| 55 | + videoUrl: null, |
| 56 | + thumb: '', |
| 57 | + full: '', |
| 58 | + img: '' |
| 59 | + } |
| 60 | + ], |
| 61 | + magnifierOpts: { |
| 62 | + enabled: false, |
| 63 | + eventType: 'hover', |
| 64 | + fullscreenzoom: '20', |
| 65 | + height: 100, |
| 66 | + largeWrapper: '[data-gallery-role=\'magnifier\']', |
| 67 | + left: 10, |
| 68 | + mode: 'outside', |
| 69 | + thumb: '.fotorama__img', |
| 70 | + top: 10, |
| 71 | + width: 100, |
| 72 | + zoomable: false |
| 73 | + } |
| 74 | + }; |
| 75 | + element = $('<div class="gallery-placeholder' + |
| 76 | + ' _block-content-loading" data-gallery-role="gallery-placeholder">' + |
| 77 | + '<img alt="main product photo" class="gallery-placeholder__image" src="">' + |
| 78 | + '</div>'); |
| 79 | + |
| 80 | + spyOn($.fn, 'data').and.callFake(function () { |
| 81 | + return { |
| 82 | + setOptions: jasmine.createSpy().and.returnValue(true), |
| 83 | + updateOptions: jasmine.createSpy().and.returnValue(true) |
| 84 | + }; |
| 85 | + }); |
| 86 | + expect(); |
| 87 | + gallery = new Gallery(options, element); |
| 88 | + |
| 89 | + }); |
| 90 | + |
| 91 | + describe('"initGallery" method', function () { |
| 92 | + it('Verify gallery initialization', function () { |
| 93 | + expect(gallery.settings.$elementF.class).toBe(element[1]); |
| 94 | + expect(gallery.settings.fullscreenConfig).toBeDefined(); |
| 95 | + expect(gallery.settings.fotoramaApi).toBeDefined(); |
| 96 | + expect(gallery.settings.data).toBeDefined(); |
| 97 | + expect(gallery.settings.api).toBeDefined(); |
| 98 | + }); |
| 99 | + }); |
| 100 | +}); |
0 commit comments