Skip to content

Commit 674594c

Browse files
committed
fix(tests): Clean and better structured tests, no coffeescript.
1 parent 8334099 commit 674594c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4165
-4173
lines changed

coffeelint.json

Lines changed: 0 additions & 114 deletions
This file was deleted.

grunt/jscs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"src": ["src/directives/*.js", "src/services/**/*.js"],
2+
"src": ["src/directives/*.js", "src/services/**/*.js", "test/**/*.js"],
33
"options": {
44
"config": ".jscsrc",
55
"fix": true

grunt/watch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"livereload": 7777
44
},
55
"fast": {
6-
"files": [ "src/**/*.js", "test/unit/**.js", "test/unit/**.coffee", "test/e2e/**.js" ],
6+
"files": [ "src/**/*.js", "test/unit/**.js", "test/e2e/**.js" ],
77
"tasks": [ "fast-build" ]
88
}
99
}

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"jasmine-core": "^2.2.0",
3434
"jsdom": "^7.0.2",
3535
"karma": "^0.13.15",
36-
"karma-coffee-preprocessor": "^0.3.0",
3736
"karma-jasmine": "^0.3.6",
3837
"karma-phantomjs-launcher": "^0.2.1",
3938
"load-grunt-config": "^0.19.0",

test/e2e/0100-basic-first-example.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
describe('Loading 0100-basic-first-example.html', function() {
44

5-
beforeEach(function() {
6-
browser.get('0100-basic-first-example.html');
7-
browser.wait(function() {
8-
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9-
}, 5000);
10-
}, 30000);
5+
beforeEach(function() {
6+
browser.get('0100-basic-first-example.html');
7+
browser.wait(function() {
8+
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9+
}, 5000);
10+
}, 30000);
1111

12-
it('should load the Leaflet map inside the directive tag', function() {
13-
element(by.className('angular-leaflet-map')).getText().then(function(text) {
14-
expect(text).toBe("+\n-\nLeaflet | © OpenStreetMap contributors");
15-
});
12+
it('should load the Leaflet map inside the directive tag', function() {
13+
element(by.className('angular-leaflet-map')).getText().then(function(text) {
14+
expect(text).toBe('+\n-\nLeaflet | © OpenStreetMap contributors');
1615
});
16+
});
1717

1818
});

test/e2e/0101-basic-center-example.js

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,36 @@
22

33
describe('Loading 0101-basic-center-example.html', function() {
44

5-
beforeEach(function() {
6-
browser.get('0101-basic-center-example.html');
7-
browser.wait(function() {
8-
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9-
}, 5000);
10-
}, 30000);
5+
beforeEach(function() {
6+
browser.get('0101-basic-center-example.html');
7+
browser.wait(function() {
8+
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9+
}, 5000);
10+
}, 30000);
1111

12-
it('should update the zoom value in the input if clicked the zoom control', function() {
13-
element(by.className('leaflet-control-zoom-in')).click();
14-
// Wait for zoom animation
15-
browser.driver.sleep(300);
16-
expect(element(by.model("london.zoom")).getAttribute("value")).toBe('5');
17-
});
12+
it('should update the zoom value in the input if clicked the zoom control', function() {
13+
element(by.className('leaflet-control-zoom-in')).click();
1814

19-
xit('should update the center value if the map is dragged', function() {
20-
expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505');
21-
expect(element(by.model("london.lng")).getAttribute("value")).toBe('-0.09');
22-
var el = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][1]'));
23-
var el2 = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][2]'));
24-
browser.actions()
25-
.mouseMove(el, {x: 5, y: 5})
26-
.mouseDown()
27-
.mouseMove(el2)
28-
.mouseUp()
29-
.perform();
15+
// Wait for zoom animation
16+
browser.driver.sleep(300);
17+
expect(element(by.model('london.zoom')).getAttribute('value')).toBe('5');
18+
});
3019

31-
browser.waitForAngular();
32-
expect(element(by.model("london.lat")).getAttribute("value")).toBe('51.505');
33-
expect(element(by.model("london.lng")).getAttribute("value")).toBe('-0.09');
34-
});
20+
xit('should update the center value if the map is dragged', function() {
21+
expect(element(by.model('london.lat')).getAttribute('value')).toBe('51.505');
22+
expect(element(by.model('london.lng')).getAttribute('value')).toBe('-0.09');
23+
var el = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][1]'));
24+
var el2 = element(by.xpath('.//img[contains(@class, "leaflet-tile-loaded")][2]'));
25+
browser.actions()
26+
.mouseMove(el, {x: 5, y: 5})
27+
.mouseDown()
28+
.mouseMove(el2)
29+
.mouseUp()
30+
.perform();
31+
32+
browser.waitForAngular();
33+
expect(element(by.model('london.lat')).getAttribute('value')).toBe('51.505');
34+
expect(element(by.model('london.lng')).getAttribute('value')).toBe('-0.09');
35+
});
3536

3637
});

test/e2e/0103-basic-center-url-hash-example.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,38 @@
22

33
describe('Loading 0103-basic-center-url-hash-example.html', function() {
44

5-
beforeEach(function() {
6-
browser.get('0103-basic-center-url-hash-example.html');
7-
browser.wait(function() {
8-
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9-
}, 5000);
10-
}, 30000);
5+
beforeEach(function() {
6+
browser.get('0103-basic-center-url-hash-example.html');
7+
browser.wait(function() {
8+
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9+
}, 5000);
10+
}, 30000);
1111

12-
it('should update the url if the center value is changed from the form', function() {
13-
element(by.xpath('//ul/li[1]/input[1]')).clear();
14-
element(by.xpath('//ul/li[1]/input[1]')).sendKeys("9");
15-
browser.driver.sleep(500);
16-
element(by.xpath('//ul/li[2]/input[1]')).clear();
17-
element(by.xpath('//ul/li[2]/input[1]')).sendKeys("7");
18-
browser.driver.sleep(500);
19-
element(by.xpath('//ul/li[3]/input[1]')).clear();
20-
element(by.xpath('//ul/li[3]/input[1]')).sendKeys("4");
21-
// Wait for zoom animation
22-
browser.driver.sleep(1500);
23-
expect(browser.driver.getCurrentUrl()).toMatch(/c=9.0153:6.9873:4$/);
24-
});
12+
it('should update the url if the center value is changed from the form', function() {
13+
element(by.xpath('//ul/li[1]/input[1]')).clear();
14+
element(by.xpath('//ul/li[1]/input[1]')).sendKeys('9');
15+
browser.driver.sleep(500);
16+
element(by.xpath('//ul/li[2]/input[1]')).clear();
17+
element(by.xpath('//ul/li[2]/input[1]')).sendKeys('7');
18+
browser.driver.sleep(500);
19+
element(by.xpath('//ul/li[3]/input[1]')).clear();
20+
element(by.xpath('//ul/li[3]/input[1]')).sendKeys('4');
2521

26-
it('should update the url if the zoom is changed from the map', function() {
27-
element(by.xpath('.//*[@title="Zoom out"]')).click();
28-
browser.driver.sleep(500);
29-
expect(browser.getCurrentUrl()).toMatch(/51.5050:-0.0900:3/);
30-
});
22+
// Wait for zoom animation
23+
browser.driver.sleep(1500);
24+
expect(browser.driver.getCurrentUrl()).toMatch(/c=9.0153:6.9873:4$/);
25+
});
3126

32-
it('should update the map center model if the url changes', function() {
33-
element(by.xpath('//ul/li[1]/a[1]')).click();
34-
expect(element(by.xpath('//ul/li[1]/input[1]')).getAttribute("value")).toBe("36.8899");
35-
expect(element(by.xpath('//ul/li[2]/input[1]')).getAttribute("value")).toBe("-121.8008");
36-
expect(element(by.xpath('//ul/li[3]/input[1]')).getAttribute("value")).toBe("12");
37-
});
27+
it('should update the url if the zoom is changed from the map', function() {
28+
element(by.xpath('.//*[@title="Zoom out"]')).click();
29+
browser.driver.sleep(500);
30+
expect(browser.getCurrentUrl()).toMatch(/51.5050:-0.0900:3/);
31+
});
32+
33+
it('should update the map center model if the url changes', function() {
34+
element(by.xpath('//ul/li[1]/a[1]')).click();
35+
expect(element(by.xpath('//ul/li[1]/input[1]')).getAttribute('value')).toBe('36.8899');
36+
expect(element(by.xpath('//ul/li[2]/input[1]')).getAttribute('value')).toBe('-121.8008');
37+
expect(element(by.xpath('//ul/li[3]/input[1]')).getAttribute('value')).toBe('12');
38+
});
3839
});

test/e2e/0104-basic-custom-parameters-example.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
describe('Loading 0104-basic-custom-parameters-example.html', function() {
44

5-
beforeEach(function() {
6-
browser.get('0104-basic-custom-parameters-example.html');
7-
browser.wait(function() {
8-
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9-
}, 5000);
10-
});
5+
beforeEach(function() {
6+
browser.get('0104-basic-custom-parameters-example.html');
7+
browser.wait(function() {
8+
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9+
}, 5000);
10+
});
1111

12-
it('should have loaded the opencyclemaps tiles', function() {
13-
expect(element(by.css('img.leaflet-tile-loaded')).getAttribute("src")).toContain("tile.opencyclemap.org");
14-
});
12+
it('should have loaded the opencyclemaps tiles', function() {
13+
expect(element(by.css('img.leaflet-tile-loaded')).getAttribute('src')).toContain('tile.opencyclemap.org');
14+
});
1515
});

test/e2e/0105-basic-bounds-example.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22

33
describe('Loading 0105-basic-bounds-example.html', function() {
44

5-
beforeEach(function() {
6-
browser.get('0105-basic-bounds-example.html');
7-
browser.wait(function() {
8-
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9-
}, 5000);
10-
});
11-
12-
it('should update the bounds values in the input if clicked the zoom control', function() {
13-
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("51.507941142609155");
14-
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-0.09059429168701172");
15-
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("51.50954376090435");
16-
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("-0.0851815938949585");
5+
beforeEach(function() {
6+
browser.get('0105-basic-bounds-example.html');
7+
browser.wait(function() {
8+
return element(by.css('img.leaflet-tile-loaded')).isPresent();
9+
}, 5000);
10+
});
1711

18-
element(by.xpath('.//*[@title="Zoom out"]')).click().then(function() {
19-
browser.driver.sleep(400);
20-
expect(element(by.model("bounds.southWest.lat")).getAttribute("value")).toBe("51.50713981232172");
21-
expect(element(by.model("bounds.southWest.lng")).getAttribute("value")).toBe("-0.09329795837402344");
22-
expect(element(by.model("bounds.northEast.lat")).getAttribute("value")).toBe("51.51034504891232");
23-
expect(element(by.model("bounds.northEast.lng")).getAttribute("value")).toBe("-0.08247256278991699");
24-
});
12+
it('should update the bounds values in the input if clicked the zoom control', function() {
13+
expect(element(by.model('bounds.southWest.lat')).getAttribute('value')).toBe('51.507941142609155');
14+
expect(element(by.model('bounds.southWest.lng')).getAttribute('value')).toBe('-0.09059429168701172');
15+
expect(element(by.model('bounds.northEast.lat')).getAttribute('value')).toBe('51.50954376090435');
16+
expect(element(by.model('bounds.northEast.lng')).getAttribute('value')).toBe('-0.0851815938949585');
2517

18+
element(by.xpath('.//*[@title="Zoom out"]')).click().then(function() {
19+
browser.driver.sleep(400);
20+
expect(element(by.model('bounds.southWest.lat')).getAttribute('value')).toBe('51.50713981232172');
21+
expect(element(by.model('bounds.southWest.lng')).getAttribute('value')).toBe('-0.09329795837402344');
22+
expect(element(by.model('bounds.northEast.lat')).getAttribute('value')).toBe('51.51034504891232');
23+
expect(element(by.model('bounds.northEast.lng')).getAttribute('value')).toBe('-0.08247256278991699');
2624
});
25+
26+
});
2727
});

0 commit comments

Comments
 (0)