@@ -39,5 +39,23 @@ describe('gridstack utils', function() {
3939
4040 } ) ;
4141
42+ describe ( 'test isIntercepted' , function ( ) {
43+ var src = { x : 3 , y : 2 , width : 3 , height : 2 } ;
44+
45+ it ( 'should intercept.' , function ( ) {
46+ expect ( utils . isIntercepted ( src , { x : 0 , y : 0 , width : 4 , height : 3 } ) ) . toEqual ( true ) ;
47+ expect ( utils . isIntercepted ( src , { x : 0 , y : 0 , width : 40 , height : 30 } ) ) . toEqual ( true ) ;
48+ expect ( utils . isIntercepted ( src , { x : 3 , y : 2 , width : 3 , height : 2 } ) ) . toEqual ( true ) ;
49+ expect ( utils . isIntercepted ( src , { x : 5 , y : 3 , width : 3 , height : 2 } ) ) . toEqual ( true ) ;
50+ } ) ;
51+
52+ it ( 'shouldn\'t intercept.' , function ( ) {
53+ expect ( utils . isIntercepted ( src , { x : 0 , y : 0 , width : 3 , height : 2 } ) ) . toEqual ( false ) ;
54+ expect ( utils . isIntercepted ( src , { x : 0 , y : 0 , width : 13 , height : 2 } ) ) . toEqual ( false ) ;
55+ expect ( utils . isIntercepted ( src , { x : 1 , y : 4 , width : 13 , height : 2 } ) ) . toEqual ( false ) ;
56+ expect ( utils . isIntercepted ( src , { x : 0 , y : 3 , width : 3 , height : 2 } ) ) . toEqual ( false ) ;
57+ expect ( utils . isIntercepted ( src , { x : 6 , y : 3 , width : 3 , height : 2 } ) ) . toEqual ( false ) ;
58+ } ) ;
59+ } ) ;
4260
43- } ) ;
61+ } ) ;
0 commit comments