Codebase list leaflet / 167a46d
Added tests for Bounds.overlaps and Bounds.intersects. (#7075) mondeja authored 4 years ago GitHub committed 4 years ago
1 changed file(s) with 21 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
7373 describe('#intersects', function () {
7474 it('returns true if bounds intersect', function () {
7575 expect(a.intersects(b)).to.be(true);
76 expect(a.intersects(new L.Bounds(new L.Point(100, 100), new L.Point(120, 120)))).to.eql(false);
76 });
77 it('two bounds intersect if they have at least one point in common', function () {
78 expect(a.intersects(new L.Bounds(new L.Point(14, 12), new L.Point(6, 5)))).to.be(true);
79 });
80 it('returns false if bounds not intersect', function () {
81 expect(a.intersects(new L.Bounds(new L.Point(100, 100), new L.Point(120, 120)))).to.eql(false);
82 });
83 });
84
85 describe('#overlaps', function () {
86 it('returns true if bounds overlaps', function () {
87 expect(a.overlaps(b)).to.be(true);
88 });
89 it('two bounds overlaps if their intersection is an area', function () {
90 // point in common
91 expect(a.overlaps(new L.Bounds(new L.Point(14, 12), new L.Point(6, 5)))).to.be(false);
92 // matching boundary
93 expect(a.overlaps(new L.Bounds(new L.Point(30, 12), new L.Point(35, 25)))).to.be(false);
94 });
95 it('returns false if bounds not overlaps', function () {
96 expect(a.overlaps(new L.Bounds(new L.Point(100, 100), new L.Point(120, 120)))).to.eql(false);
7797 });
7898 });
7999