[#141,view/map][s]: support for all of elasticsearch geo_point / location objects - fixes #141.

* [lon, lat]
* "lat,lon"
* Bonus (non-ES): "(lat,lon)"

Also (accidentally included):

* upgrade to qunit 1.5.0 (much better stack traces!)
This commit is contained in:
Rufus Pollock
2012-06-11 21:58:13 +01:00
parent 7b07a9558b
commit 75cd2fb94d
5 changed files with 1100 additions and 756 deletions

View File

@@ -105,21 +105,25 @@ test('GeoJSON geom field', function () {
view.remove();
});
test('geom field non-GeoJSON', function () {
var data = [{
location: { lon: 47, lat: 53},
title: 'abc'
}];
var dataset = recline.Backend.Memory.createDataset(data);
test('_getGeometryFromRecord non-GeoJSON', function () {
var test = [
[{ lon: 47, lat: 53}, [47,53]],
["53.3,47.32", [47.32, 53.3]],
["53.3, 47.32", [47.32, 53.3]],
["(53.3,47.32)", [47.32, 53.3]],
[[53.3,47.32], [53.3, 47.32]]
];
var view = new recline.View.Map({
model: dataset
model: recline.Backend.Memory.createDataset([{a: 1}]),
state: {
geomField: 'location'
}
});
_.each(test, function(item) {
var record = new recline.Model.Record({location: item[0]});
var out = view._getGeometryFromRecord(record);
deepEqual(out.coordinates, item[1]);
});
//Fire query, otherwise the map won't be initialized
dataset.query();
// Check that all features were created
equal(_getFeaturesCount(view.features), 1);
});
test('Popup', function () {