mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-03 18:03:38 +00:00
By default, the `rendererBackground` code will choose an initial imagery based on what sources are available at the given map location. It looks like this code will fallback to "custom" _before_ "none", and I noticed that in some cases it was trying to fetch whatever source happened to be stored in the "custom" template in localStorage. This commit adds an explicit window.location.hash in a few places to encourage the background layer to be "none". Some tests do change the hash, so this isn't perfect.
67 lines
2.2 KiB
JavaScript
67 lines
2.2 KiB
JavaScript
describe('iD.modeAddNote', function() {
|
|
var context;
|
|
|
|
before(function() {
|
|
window.location.hash = '#background=none'; // Try not to load imagery
|
|
iD.services.osm = iD.serviceOsm;
|
|
});
|
|
|
|
after(function() {
|
|
delete iD.services.osm;
|
|
});
|
|
|
|
beforeEach(function() {
|
|
var container = d3.select(document.createElement('div'));
|
|
context = iD.coreContext().assetPath('../dist/').container(container).init();
|
|
|
|
context.loadTiles = function () {};
|
|
|
|
container.call(context.map())
|
|
.append('div')
|
|
.attr('class', 'inspector-wrap');
|
|
|
|
context.map().centerZoom([-77.02271, 38.90085], 20);
|
|
context.enter(iD.modeAddNote(context));
|
|
});
|
|
|
|
describe('clicking the map', function () {
|
|
it('adds a note', function(done) {
|
|
var note = iD.osmNote({
|
|
id: '-1',
|
|
comments: [],
|
|
loc: [-77.02271, 38.90085],
|
|
status: 'open'
|
|
});
|
|
happen.mousedown(context.surface().node(), {});
|
|
happen.mouseup(window, {});
|
|
|
|
window.setTimeout(function() {
|
|
expect(iD.services.osm.caches().note.note[-1]).to.eql(note);
|
|
context.mode().exit();
|
|
d3.select('window').on('click.draw-block', null);
|
|
done();
|
|
}, 50);
|
|
});
|
|
|
|
// this won't work because draw behavior can only snap to entities, not notes
|
|
// it('selects an existing note rather than adding a new one', function() {
|
|
// happen.mousedown(context.surface().node(), {});
|
|
// happen.mouseup(window, {});
|
|
// expect(context.selectedNoteID()).to.eql(-1);
|
|
// expect(context.mode().id).to.equal('select-note');
|
|
// context.mode().exit();
|
|
// d3.select('window').on('click.draw-block', null);
|
|
// });
|
|
});
|
|
|
|
// describe('pressing ⎋', function() {
|
|
// it('exits to browse mode', function(done) {
|
|
// happen.keydown(document, {keyCode: 27});
|
|
// window.setTimeout(function() {
|
|
// expect(context.mode().id).to.equal('browse');
|
|
// done();
|
|
// }, 200);
|
|
// });
|
|
// });
|
|
});
|