Skip to content

Commit 5101c96

Browse files
committed
test enhancement and bug fixes on example
1 parent 5ccf2c9 commit 5101c96

File tree

5 files changed

+27
-39
lines changed

5 files changed

+27
-39
lines changed

config/protractor.conf.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,12 @@ exports.config = {
66

77
browserName: 'chrome',
88

9-
// Exclude patterns are relative to this directory.
10-
// exclude: [],
11-
12-
// run tests in parallel
13-
//capabilities: {
14-
// browserName: 'chrome',
15-
// shardTestFiles: true,
16-
// maxInstances: 10
17-
//},
18-
199
jasmineNodeOpts: {
2010
showColors: true,
2111
isVerbose: true, // List all tests in the console
2212
includeStackTrace: true,
2313
defaultTimeoutInterval: 10000
2414
},
2515

26-
plugins: [{
27-
path: __dirname + '/../node_modules/gulp-protractor/node_modules/' +
28-
'protractor/node_modules/jasmine/node_modules/jasmine-core/lib/console/console.js',
29-
failOnWarning: true,
30-
failOnError: true
31-
}],
32-
3316
baseUrl: 'http://localhost:8888'
3417
};

controllers/map-controller.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@
204204
var controlOptions = Attr2MapOptions.getControlOptions(filtered);
205205
var mapOptions = angular.extend(options, controlOptions);
206206
var mapEvents = Attr2MapOptions.getEvents($scope, filtered);
207-
console.log('ng-map Options', mapOptions);
208207
Object.keys(mapEvents).length && console.log('ng-map Events', mapEvents);
209208

210209
vm.mapOptions = mapOptions;

services/attr2-map-options.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@
127127
} // catch(err2)
128128
} // catch(err)
129129

130+
// convert output more for center and position
131+
if (
132+
(options.key == 'center' || options.key == 'center') &&
133+
output instanceof Array
134+
) {
135+
output = new google.maps.LatLng(output[0], output[1]);
136+
}
137+
130138
// convert output more for shape bounds
131139
if (options.key == 'bounds' && output instanceof Array) {
132140
output = new google.maps.LatLngBounds(output[0], output[1]);

spec/e2e/testapp_spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,7 @@ describe('testapp directory', function() {
2929
});
3030
console.log('files to run', allFiles);
3131

32-
afterEach(function() {
33-
browser.manage().logs().get('browser').then(function(browserLog) {
34-
expect(browserLog.length).toEqual(0);
35-
browserLog.length && console.log(JSON.stringify(browserLog));
36-
});
37-
});
38-
32+
//TODO: apply retry when it has console error. e.g. google image 404 error
3933
allFiles.forEach(function(filename) {
4034
using(filename, function(url){
4135
it('testapp/'+url, function() {
@@ -50,7 +44,13 @@ describe('testapp directory', function() {
5044
}).then(function(map) {
5145
return map;
5246
});
53-
}, 5000);
47+
}, 2000);
48+
49+
browser.manage().logs().get('browser').then(function(browserLog) {
50+
expect(browserLog.length).toEqual(0);
51+
browserLog.length && console.log(JSON.stringify(browserLog));
52+
});
53+
5454
});
5555
});
5656
});

testapp/places-auto-complete.html

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
66
<script src="script-tags-for-development.js"></script>
77
<script>
8-
angular.module('myApp', ['ngMap'])
9-
.controller('MyCtrl', function() {
10-
var vm = this;
11-
vm.types = "['establishment']";
12-
vm.placeChanged = function() {
13-
vm.place = this.getPlace();
14-
console.log(
15-
vm.place.geometry.location.lat(),
16-
vm.place.geometry.location.lng()
17-
);
18-
vm.map.setCenter(vm.place.geometry.location);
19-
}
8+
angular.module('myApp', ['ngMap']).controller('MyCtrl', function(NgMap) {
9+
var vm = this;
10+
vm.types = "['establishment']";
11+
vm.placeChanged = function() {
12+
vm.place = this.getPlace();
13+
console.log('location', vm.place.geometry.location);
14+
vm.map.setCenter(vm.place.geometry.location);
15+
}
16+
NgMap.getMap().then(function(map) {
17+
vm.map = map;
18+
});
2019
});
2120
</script>
2221
</head>
@@ -43,4 +42,3 @@
4342
<map></ng-map>
4443
</body>
4544
</html>
46-

0 commit comments

Comments
 (0)