-
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.
ENGCOM-6285: The image details are not hidden when click on same image …
- Loading branch information
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
50 changes: 50 additions & 0 deletions
50
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/image-preview.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,50 @@ | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
/* eslint-disable max-nested-callbacks, no-undef */ | ||
|
||
define([ | ||
'Magento_Ui/js/grid/columns/image-preview', | ||
'ko', | ||
'jquery' | ||
], function (Preview, ko, $) { | ||
'use strict'; | ||
|
||
describe('Ui/js/grid/columns/image-preview', function () { | ||
var record = { | ||
_rowIndex: 1, | ||
rowNumber: 1 | ||
}, | ||
imagePreview; | ||
|
||
beforeEach(function () { | ||
imagePreview = new Preview(); | ||
|
||
/** | ||
* @return {Object} | ||
*/ | ||
function getThumbnail() { | ||
return { | ||
previewRowId: ko.observable() | ||
}; | ||
} | ||
|
||
imagePreview.thumbnailComponent = getThumbnail; | ||
|
||
imagePreview.visibleRecord = ko.observable(1); | ||
}); | ||
|
||
describe('show method', function () { | ||
it('show image', function () { | ||
var mockImg = document.createElement('img'), | ||
hide = spyOn(imagePreview, 'hide'); | ||
|
||
spyOn($.fn, 'get').and.returnValue(mockImg); | ||
imagePreview.show(record); | ||
expect(hide).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
}); | ||
}); | ||
}); |