diff --git a/js/id/format/xml.js b/js/id/format/xml.js
index 5334b2d84..928c9c97c 100644
--- a/js/id/format/xml.js
+++ b/js/id/format/xml.js
@@ -1,19 +1,8 @@
iD.format.XML = {
- mapping: function(entity) {
- if (iD.format.XML.mappings[entity.type]) {
- return iD.format.XML.mappings[entity.type](entity);
- }
- },
- rep: function(entity, changeset_id) {
- if (iD.format.XML.reps[entity.type]) {
- return iD.format.XML.reps[entity.type](entity, changeset_id);
- } else {
- if (typeof console !== 'undefined') console.log(entity.type);
- }
- },
decode: function(s) {
return s.replace(/>/g,'>').replace(/');
});
});
-
- describe('#mapping', function() {
- it('serializes a node to xml', function() {
- expect(iD.format.XML.mapping({ id: 'n-1', type: 'node', loc: [-77, 38] }))
- .to.equal('<node id="-1" lon="-77" lat="38" version="0"/>');
- });
-
- it('serializes a way to xml', function() {
- expect(iD.format.XML.mapping({ type: 'way', nodes: [], id: 'w-1' }))
- .to.equal('<way id="-1" version="0"/>');
- });
- });
});
diff --git a/test/spec/graph/node.js b/test/spec/graph/node.js
index 75696533f..ad149261e 100644
--- a/test/spec/graph/node.js
+++ b/test/spec/graph/node.js
@@ -52,6 +52,22 @@ describe('iD.Node', function () {
});
});
+ describe("#asJXON", function () {
+ it('converts a node to jxon', function() {
+ var node = iD.Node({id: 'n-1', loc: [-77, 38], tags: {amenity: 'cafe'}});
+ expect(node.asJXON()).to.eql({node: {
+ '@id': '-1',
+ '@lon': -77,
+ '@lat': 38,
+ '@version': 0,
+ tag: [{keyAttributes: {k: 'amenity', v: 'cafe'}}]}});
+ });
+
+ it('includes changeset if provided', function() {
+ expect(iD.Node({loc: [0, 0]}).asJXON('1234').node['@changeset']).to.equal('1234');
+ });
+ });
+
describe("#asGeoJSON", function () {
it("converts to a GeoJSON Point features", function () {
var node = iD.Node({tags: {amenity: 'cafe'}, loc: [1, 2]}),
diff --git a/test/spec/graph/way.js b/test/spec/graph/way.js
index d59185a17..ec41edec6 100644
--- a/test/spec/graph/way.js
+++ b/test/spec/graph/way.js
@@ -200,6 +200,21 @@ describe('iD.Way', function() {
});
});
+ describe("#asJXON", function () {
+ it('converts a way to jxon', function() {
+ var node = iD.Way({id: 'w-1', nodes: ['n1', 'n2'], tags: {highway: 'residential'}});
+ expect(node.asJXON()).to.eql({way: {
+ '@id': '-1',
+ '@version': 0,
+ nd: [{keyAttributes: {ref: '1'}}, {keyAttributes: {ref: '2'}}],
+ tag: [{keyAttributes: {k: 'highway', v: 'residential'}}]}});
+ });
+
+ it('includes changeset if provided', function() {
+ expect(iD.Way().asJXON('1234').way['@changeset']).to.equal('1234');
+ });
+ });
+
describe("#asGeoJSON", function () {
it("converts to a GeoJSON LineString features", function () {
var a = iD.Node({loc: [1, 2]}),