Commit | Line | Data |
---|---|---|
c5ba5b04 JW |
1 | describe('Bounds', function() {\r |
2 | var a, b;\r | |
3 | \r | |
4 | beforeEach(function() {\r | |
5 | a = new L.Bounds(\r | |
6 | new L.Point(14, 12),\r | |
7 | new L.Point(30, 40));\r | |
8 | b = new L.Bounds([\r | |
9 | new L.Point(20, 12),\r | |
10 | new L.Point(14, 20),\r | |
11 | new L.Point(30, 40)\r | |
12 | ]);\r | |
13 | });\r | |
14 | \r | |
15 | describe('constructor', function() {\r | |
16 | it('should create bounds with proper min & max on (Point, Point)', function() {\r | |
17 | expect(a.min).toEqual(new L.Point(14, 12));\r | |
18 | expect(a.max).toEqual(new L.Point(30, 40));\r | |
19 | });\r | |
20 | it('should create bounds with proper min & max on (Point[])', function() {\r | |
21 | expect(b.min).toEqual(new L.Point(14, 12));\r | |
22 | expect(b.max).toEqual(new L.Point(30, 40));\r | |
23 | });\r | |
24 | });\r | |
25 | \r | |
26 | describe('#extend', function() {\r | |
27 | it('should extend the bounds to contain the given point', function() {\r | |
28 | a.extend(new L.Point(50, 20));\r | |
29 | expect(a.min).toEqual(new L.Point(14, 12));\r | |
30 | expect(a.max).toEqual(new L.Point(50, 40));\r | |
31 | \r | |
32 | b.extend(new L.Point(25, 50));\r | |
33 | expect(b.min).toEqual(new L.Point(14, 12));\r | |
34 | expect(b.max).toEqual(new L.Point(30, 50));\r | |
35 | });\r | |
36 | });\r | |
37 | \r | |
38 | describe('#getCenter', function() {\r | |
39 | it('should return the center point', function() {\r | |
40 | expect(a.getCenter()).toEqual(new L.Point(22, 26));\r | |
41 | });\r | |
42 | });\r | |
43 | }); |