mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-18 14:45:12 +02:00
Auto-zoom to entity specified by id param
This commit is contained in:
@@ -79,6 +79,59 @@ describe('iD.Connection', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#loadEntity', function () {
|
||||
var server,
|
||||
nodeXML = '<?xml version="1.0" encoding="UTF-8"?><osm><node id="1" version="1" changeset="1" lat="0" lon="0" visible="true" timestamp="2009-03-07T03:26:33Z"></node></osm>',
|
||||
wayXML = '<?xml version="1.0" encoding="UTF-8"?><osm>' +
|
||||
'<node id="1" version="1" changeset="2817006" lat="0" lon="0" visible="true" timestamp="2009-10-11T18:03:23Z"/>' +
|
||||
'<way id="1" visible="true" timestamp="2008-01-03T05:24:43Z" version="1" changeset="522559"><nd ref="1"/></way>' +
|
||||
'</osm>';
|
||||
|
||||
beforeEach(function() {
|
||||
server = sinon.fakeServer.create();
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
server.restore();
|
||||
});
|
||||
|
||||
it('loads a node', function(done) {
|
||||
c.loadEntity('n1', function(error, entity) {
|
||||
expect(entity).to.be.an.instanceOf(iD.Node);
|
||||
expect(entity.id).to.eql('n1');
|
||||
done();
|
||||
});
|
||||
|
||||
server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/node/1",
|
||||
[200, { "Content-Type": "text/xml" }, nodeXML]);
|
||||
server.respond();
|
||||
});
|
||||
|
||||
it('loads a way', function(done) {
|
||||
c.loadEntity('w1', function(error, entity) {
|
||||
expect(entity).to.be.an.instanceOf(iD.Way);
|
||||
expect(entity.id).to.eql('w1');
|
||||
done();
|
||||
});
|
||||
|
||||
server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/way/1/full",
|
||||
[200, { "Content-Type": "text/xml" }, wayXML]);
|
||||
server.respond();
|
||||
});
|
||||
|
||||
it('emits a load event', function(done) {
|
||||
c.loadEntity('n1');
|
||||
c.on('load', function(error, result) {
|
||||
expect(result.n1).to.be.an.instanceOf(iD.Node);
|
||||
done();
|
||||
});
|
||||
|
||||
server.respondWith("GET", "http://www.openstreetmap.org/api/0.6/node/1",
|
||||
[200, { "Content-Type": "text/xml" }, nodeXML]);
|
||||
server.respond();
|
||||
});
|
||||
});
|
||||
|
||||
describe('#osmChangeJXON', function() {
|
||||
it('converts change data to JXON', function() {
|
||||
var jxon = c.osmChangeJXON('jfire', '1234', {created: [], modified: [], deleted: []});
|
||||
|
||||
Reference in New Issue
Block a user