Skip to content

Commit

Permalink
cover Utils.isIntercepted
Browse files Browse the repository at this point in the history
  • Loading branch information
troolee committed Feb 23, 2016
1 parent 9168a7f commit cddbf07
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion spec/utils-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,23 @@ describe('gridstack utils', function() {

});

describe('test isIntercepted', function() {
var src = {x: 3, y: 2, width: 3, height: 2};

it('should intercept.', function() {
expect(utils.isIntercepted(src, {x: 0, y: 0, width: 4, height: 3})).toEqual(true);
expect(utils.isIntercepted(src, {x: 0, y: 0, width: 40, height: 30})).toEqual(true);
expect(utils.isIntercepted(src, {x: 3, y: 2, width: 3, height: 2})).toEqual(true);
expect(utils.isIntercepted(src, {x: 5, y: 3, width: 3, height: 2})).toEqual(true);
});

it('shouldn\'t intercept.', function() {
expect(utils.isIntercepted(src, {x: 0, y: 0, width: 3, height: 2})).toEqual(false);
expect(utils.isIntercepted(src, {x: 0, y: 0, width: 13, height: 2})).toEqual(false);
expect(utils.isIntercepted(src, {x: 1, y: 4, width: 13, height: 2})).toEqual(false);
expect(utils.isIntercepted(src, {x: 0, y: 3, width: 3, height: 2})).toEqual(false);
expect(utils.isIntercepted(src, {x: 6, y: 3, width: 3, height: 2})).toEqual(false);
});
});

});
});

0 comments on commit cddbf07

Please sign in to comment.