Create osmChangeset object, inherit from osmEntity

This commit is contained in:
Bryan Housel
2017-03-11 00:41:15 -05:00
parent e0157f48ac
commit f783fe4942
5 changed files with 86 additions and 2 deletions
+1
View File
@@ -81,6 +81,7 @@
<script src='spec/modes/add_point.js'></script>
<script src='spec/osm/changeset.js'></script>
<script src='spec/osm/entity.js'></script>
<script src='spec/osm/intersection.js'></script>
<script src='spec/osm/multipolygon.js'></script>
+29
View File
@@ -0,0 +1,29 @@
describe('iD.osmChangeset', function () {
it('returns a changeset', function () {
expect(iD.osmChangeset()).to.be.an.instanceOf(iD.osmChangeset);
expect(iD.osmChangeset().type).to.equal('changeset');
});
it('defaults tags to an empty object', function () {
expect(iD.osmChangeset().tags).to.eql({});
});
it('sets tags as specified', function () {
expect(iD.osmChangeset({tags: {foo: 'bar'}}).tags).to.eql({foo: 'bar'});
});
describe('#asJXON', function () {
it('converts a node to jxon', function() {
var node = iD.osmChangeset({tags: {'comment': 'hello'}});
expect(node.asJXON()).to.eql({
osm: {
changeset: {
tag: [{ '@k': 'comment', '@v': 'hello' }],
'@version': 0.6,
'@generator': 'iD'
}
}
});
});
});
});