File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -46,5 +46,37 @@ define([
4646 } ) ;
4747
4848 } ) ;
49+
50+ describe ( 'handleKeyDown method' , function ( ) {
51+ it ( 'veify record changed on key down' , function ( ) {
52+ var recordMock = {
53+ _rowIndex : 2
54+ } ,
55+ secondRecordMock = {
56+ _rowIndex : 1 ,
57+ rowNumber : 1
58+ } ,
59+ elementMock = {
60+ keyCode : 37
61+ } ,
62+ masonryMock = {
63+ shows : jasmine . createSpy ( ) . and . returnValue ( [ ] ) ,
64+ rows : jasmine . createSpy ( ) . and . returnValue ( {
65+ 1 : secondRecordMock
66+ } )
67+
68+ } ,
69+ imageMock = document . createElement ( 'img' ) ;
70+
71+ spyOn ( $ . fn , 'get' ) . and . returnValue ( imageMock ) ;
72+ imagePreview . visibleRecord = jasmine . createSpy ( ) . and . returnValue ( 2 ) ;
73+ imagePreview . displayedRecord = ko . observable ( ) ;
74+ imagePreview . displayedRecord ( recordMock ) ;
75+ imagePreview . masonry = jasmine . createSpy ( ) . and . returnValue ( masonryMock ) ;
76+ imagePreview . handleKeyDown ( elementMock ) ;
77+ expect ( imagePreview . displayedRecord ( ) . _rowIndex ) . toBe ( secondRecordMock . _rowIndex ) ;
78+ } ) ;
79+
80+ } ) ;
4981 } ) ;
5082} ) ;
You can’t perform that action at this time.
0 commit comments