|
| 1 | +/** |
| 2 | + * Copyright © Magento, Inc. All rights reserved. |
| 3 | + * See COPYING.txt for license details. |
| 4 | + */ |
| 5 | + |
| 6 | +/*eslint max-nested-callbacks: 0*/ |
| 7 | + |
| 8 | +define([ |
| 9 | + 'jquery', |
| 10 | + 'squire' |
| 11 | +], function ($, Squire) { |
| 12 | + 'use strict'; |
| 13 | + |
| 14 | + describe('Magento_Backend/js/media-uploader', function () { |
| 15 | + let injector = new Squire(), |
| 16 | + mediaUploaderComponent; |
| 17 | + |
| 18 | + beforeEach(function (done) { |
| 19 | + injector.require([ |
| 20 | + 'Magento_Backend/js/media-uploader', |
| 21 | + 'knockoutjs/knockout-es5' |
| 22 | + ], function (mediaUploader) { |
| 23 | + mediaUploaderComponent = new mediaUploader({}); |
| 24 | + done(); |
| 25 | + }); |
| 26 | + }); |
| 27 | + |
| 28 | + afterEach(function () { |
| 29 | + try { |
| 30 | + injector.clean(); |
| 31 | + injector.remove(); |
| 32 | + } catch (e) { |
| 33 | + } |
| 34 | + }); |
| 35 | + |
| 36 | + describe('_create() method', function () { |
| 37 | + it('_create method to be trigger and check the dropzone attribute key and value', function () { |
| 38 | + spyOn(jQuery.fn, 'fileupload'); |
| 39 | + mediaUploaderComponent._create(); |
| 40 | + expect(jQuery.fn.fileupload).toHaveBeenCalledWith( |
| 41 | + jasmine.objectContaining({ |
| 42 | + dropZone: mediaUploaderComponent. |
| 43 | + element.find('input[type=file]') |
| 44 | + .closest('[role="dialog"]') |
| 45 | + } |
| 46 | + )); |
| 47 | + }); |
| 48 | + }); |
| 49 | + }); |
| 50 | +}); |
0 commit comments