File tree 1 file changed +50
-0
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns
1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright © Magento, Inc. All rights reserved.
3
+ * See COPYING.txt for license details.
4
+ */
5
+ /* eslint-disable max-nested-callbacks, no-undef */
6
+
7
+ define ( [
8
+ 'Magento_Ui/js/grid/columns/image-preview' ,
9
+ 'ko' ,
10
+ 'jquery'
11
+ ] , function ( Preview , ko , $ ) {
12
+ 'use strict' ;
13
+
14
+ describe ( 'Ui/js/grid/columns/image-preview' , function ( ) {
15
+ var record = {
16
+ _rowIndex : 1 ,
17
+ rowNumber : 1
18
+ } ,
19
+ imagePreview ;
20
+
21
+ beforeEach ( function ( ) {
22
+ imagePreview = new Preview ( ) ;
23
+
24
+ /**
25
+ * @return {Object }
26
+ */
27
+ function getThumbnail ( ) {
28
+ return {
29
+ previewRowId : ko . observable ( )
30
+ } ;
31
+ }
32
+
33
+ imagePreview . thumbnailComponent = getThumbnail ;
34
+
35
+ imagePreview . visibleRecord = ko . observable ( 1 ) ;
36
+ } ) ;
37
+
38
+ describe ( 'show method' , function ( ) {
39
+ it ( 'show image' , function ( ) {
40
+ var mockImg = document . createElement ( 'img' ) ,
41
+ hide = spyOn ( imagePreview , 'hide' ) ;
42
+
43
+ spyOn ( $ . fn , 'get' ) . and . returnValue ( mockImg ) ;
44
+ imagePreview . show ( record ) ;
45
+ expect ( hide ) . toHaveBeenCalledTimes ( 1 ) ;
46
+ } ) ;
47
+
48
+ } ) ;
49
+ } ) ;
50
+ } ) ;
You can’t perform that action at this time.
0 commit comments