mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
added tests for osm/note
This commit is contained in:
@@ -9,7 +9,6 @@ export function actionMoveNote(noteID, toLoc) {
|
||||
|
||||
var note = services.osm.getNote(noteID);
|
||||
note.move(geoVecInterp(note.loc, toLoc, t));
|
||||
// TODO: update
|
||||
};
|
||||
|
||||
action.transitionable = true;
|
||||
|
||||
@@ -329,7 +329,7 @@ function parseXML(xml, callback, options) {
|
||||
// replace or remove note from rtree
|
||||
function updateRtree(item, replace) { // update (or insert) in _noteCache.rtree
|
||||
|
||||
// TODO: other checks needed? (e.g., if cache.data.children.length decrements ...)
|
||||
// NOTE: other checks needed? (e.g., if cache.data.children.length decrements ...)
|
||||
|
||||
// remove note
|
||||
_noteCache.rtree.remove(item, function isEql(a, b) { return a.data.id === b.data.id; });
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { geoVecInterp } from '../geo';
|
||||
|
||||
describe('iD.osmNote', function () {
|
||||
it('returns a note', function () {
|
||||
expect(iD.osmNote()).to.be.an.instanceOf(iD.osmNote);
|
||||
@@ -10,6 +12,40 @@ describe('iD.osmNote', function () {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: add tests for #update, or remove function
|
||||
describe('#update', function() {
|
||||
it('returns an updated note', function() {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isNew', function() {
|
||||
it('returns true if a note is new', function() {
|
||||
var note = iD.osmNote({
|
||||
id: -1,
|
||||
loc: [5, 10]
|
||||
});
|
||||
expect(note.isNew()).to.be.true;
|
||||
});
|
||||
it('returns false if a note is not new', function() {
|
||||
var note = iD.osmNote({
|
||||
id: 1,
|
||||
loc: [5, 10]
|
||||
});
|
||||
expect(note.isNew()).to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
describe('#move', function() {
|
||||
it('returns an moved note', function() {
|
||||
var note = iD.osmNote({
|
||||
id: 1,
|
||||
loc: [5, 10]
|
||||
});
|
||||
|
||||
var moveAmount = geoVecInterp(note.loc, [10, 10], 1);
|
||||
note.move(moveAmount);
|
||||
expect(note.loc).to.equal([10, 10]);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user