mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 01:02:58 +00:00
Before calling init() make sure the assetPath is set
init kicks off building the ui, which can fetch spritesheets for the <defs> The assetPath needs to be set otherwise these files will not be found
This commit is contained in:
@@ -5,7 +5,7 @@ describe('iD.behaviorHash', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
var container = d3.select(document.createElement('div'));
|
||||
context = iD.coreContext().init().container(container);
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(container);
|
||||
container.call(context.map());
|
||||
hash = iD.behaviorHash(context);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.behaviorLasso', function () {
|
||||
var context, lasso;
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map());
|
||||
|
||||
@@ -3,7 +3,7 @@ describe('iD.behaviorSelect', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
container = d3.select('body').append('div');
|
||||
context = iD.coreContext().init().container(container);
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(container);
|
||||
|
||||
a = iD.osmNode({loc: [0, 0]});
|
||||
b = iD.osmNode({loc: [0, 0]});
|
||||
|
||||
@@ -5,7 +5,7 @@ describe('iD.coreContext', function() {
|
||||
|
||||
describe('#assetPath', function() {
|
||||
it('sets and gets assetPath', function() {
|
||||
var context = iD.coreContext().init();
|
||||
var context = iD.coreContext();
|
||||
expect(context.assetPath()).to.eql('');
|
||||
|
||||
context.assetPath('iD/');
|
||||
@@ -15,7 +15,7 @@ describe('iD.coreContext', function() {
|
||||
|
||||
describe('#assetMap', function() {
|
||||
it('sets and gets assetMap', function() {
|
||||
var context = iD.coreContext().init();
|
||||
var context = iD.coreContext();
|
||||
expect(context.assetMap()).to.eql({});
|
||||
|
||||
context.assetMap(assets);
|
||||
@@ -26,7 +26,7 @@ describe('iD.coreContext', function() {
|
||||
describe('#asset', function() {
|
||||
var context;
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().assetPath('iD/').assetMap(assets).init();
|
||||
context = iD.coreContext().assetPath('iD/').assetMap(assets);
|
||||
});
|
||||
|
||||
it('ignores absolute urls', function() {
|
||||
@@ -44,7 +44,7 @@ describe('iD.coreContext', function() {
|
||||
describe('#imagePath', function() {
|
||||
var context;
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().assetPath('iD/').assetMap(assets).init();
|
||||
context = iD.coreContext().assetPath('iD/').assetMap(assets);
|
||||
});
|
||||
|
||||
it('looks first in assetMap', function() {
|
||||
@@ -57,7 +57,7 @@ describe('iD.coreContext', function() {
|
||||
|
||||
describe('#debug', function() {
|
||||
it('sets and gets debug flags', function() {
|
||||
var context = iD.coreContext().init();
|
||||
var context = iD.coreContext();
|
||||
var flags = {
|
||||
tile: false,
|
||||
collision: false,
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('iD.coreHistory', function () {
|
||||
};
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
history = context.history();
|
||||
spy = sinon.spy();
|
||||
// clear lock
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.coreValidator', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createInvalidWay() {
|
||||
|
||||
@@ -11,9 +11,7 @@ describe('iD.modeAddNote', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
var container = d3.select(document.createElement('div'));
|
||||
context = iD.coreContext()
|
||||
.container(container)
|
||||
.init();
|
||||
context = iD.coreContext().assetPath('../dist/').container(container).init();
|
||||
|
||||
context.loadTiles = function () {};
|
||||
|
||||
|
||||
@@ -3,11 +3,7 @@ describe.skip('iD.modeAddPoint', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
var container = d3.select(document.createElement('div'));
|
||||
|
||||
context = iD.coreContext()
|
||||
.container(container)
|
||||
.init();
|
||||
|
||||
context = iD.coreContext().assetPath('../dist/').container(container).init();
|
||||
context.loadTiles = function () {};
|
||||
|
||||
container.call(context.map())
|
||||
|
||||
@@ -3,7 +3,7 @@ describe('iD.rendererFeatures', function() {
|
||||
var context, features;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map());
|
||||
|
||||
@@ -3,7 +3,7 @@ describe('iD.Map', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
content = d3.select('body').append('div');
|
||||
context = iD.coreContext().init().container(content);
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(content);
|
||||
map = context.map();
|
||||
content.call(map);
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.rendererTileLayer', function() {
|
||||
var context, d, c;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d = d3.select(document.createElement('div'));
|
||||
c = iD.rendererTileLayer(context).projection(d3.geoMercator());
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('iD.serviceOsm', function () {
|
||||
beforeEach(function () {
|
||||
serverFetch = window.fakeFetch().create(); // unauthenticated calls use d3-fetch
|
||||
serverXHR = sinon.fakeServer.create(); // authenticated calls use XHR via osm-auth
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
connection = context.connection();
|
||||
connection.switch({ urlroot: 'http://www.openstreetmap.org' });
|
||||
connection.reset();
|
||||
|
||||
@@ -10,7 +10,7 @@ describe('iD.svgAreas', function () {
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map().centerZoom([0, 0], 17));
|
||||
|
||||
@@ -81,7 +81,7 @@ describe('iD.svgData', function () {
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map().centerZoom([-74.389286, 40.1502754], 17));
|
||||
|
||||
@@ -6,7 +6,7 @@ describe('iD.svgLayers', function () {
|
||||
.clipExtent([[0, 0], [Infinity, Infinity]]);
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
container = d3.select(document.createElement('div'));
|
||||
});
|
||||
|
||||
@@ -44,4 +44,4 @@ describe('iD.svgLayers', function () {
|
||||
expect(d3.select(nodes[14]).classed('touch')).to.be.true;
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('iD.svgLines', function () {
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map().centerZoom([0, 0], 17));
|
||||
|
||||
@@ -9,7 +9,7 @@ describe('iD.svgMidpoints', function () {
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
context.enter({
|
||||
id: 'select',
|
||||
enter: function() { },
|
||||
|
||||
@@ -6,7 +6,7 @@ describe('iD.svgPoints', function () {
|
||||
.clipExtent([[0, 0], [Infinity, Infinity]]);
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map().centerZoom([0, 0], 17));
|
||||
|
||||
@@ -8,7 +8,7 @@ describe('iD.svgVertices', function () {
|
||||
|
||||
|
||||
beforeEach(function () {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
d3.select(document.createElement('div'))
|
||||
.attr('class', 'main-map')
|
||||
.call(context.map().centerZoom([0, 0], 17));
|
||||
|
||||
@@ -63,7 +63,7 @@ describe('uiCombobox', function() {
|
||||
beforeEach(function() {
|
||||
body = d3.select('body');
|
||||
container = body.append('div').attr('class', 'ideditor');
|
||||
context = iD.coreContext().init().container(container);
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(container);
|
||||
content = container.append('div');
|
||||
input = content.append('input');
|
||||
combobox = iD.uiCombobox(context);
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.uiFieldAccess', function() {
|
||||
var context, selection, field;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
selection = d3.select(document.createElement('div'));
|
||||
field = iD.presetField('access', {
|
||||
keys: ['access', 'foot', 'motor_vehicle', 'bicycle', 'horse'],
|
||||
|
||||
@@ -15,7 +15,7 @@ describe('iD.uiFieldLocalized', function() {
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
selection = d3.select(document.createElement('div'));
|
||||
field = iD.presetField('name', { key: 'name', type: 'localized' });
|
||||
field.locked = function() { return false; };
|
||||
|
||||
@@ -18,7 +18,7 @@ describe('iD.uiFieldWikipedia', function() {
|
||||
|
||||
beforeEach(function() {
|
||||
entity = iD.osmNode({id: 'n12345'});
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
context.history().merge([entity]);
|
||||
selection = d3.select(document.createElement('div'));
|
||||
field = iD.presetField('wikipedia', {
|
||||
|
||||
@@ -3,7 +3,7 @@ describe('iD.uiFlash', function () {
|
||||
|
||||
beforeEach(function() {
|
||||
var container = d3.select('body');
|
||||
context = iD.coreContext().init().container(container);
|
||||
context = iD.coreContext().assetPath('../dist/').init().container(container);
|
||||
container
|
||||
.append('div')
|
||||
.attr('class', 'flash-wrap')
|
||||
|
||||
@@ -16,7 +16,7 @@ describe('iD.uiSectionRawTagEditor', function() {
|
||||
|
||||
beforeEach(function () {
|
||||
entity = iD.osmNode({id: 'n12345'});
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
context.history().merge([entity]);
|
||||
render({highway: 'residential'});
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.almost_junction', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function horizontalVertialCloserThanThd() {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.crossing_ways', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWaysWithOneCrossingPoint(tags1, tags2) {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.disconnected_way', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.incompatible_source', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.missing_role', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.missing_tag', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('iD.validations.private_data', function () {
|
||||
var context;
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
@@ -38,7 +38,7 @@ describe('iD.validations.suspicious_name', function () {
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
context = iD.coreContext().init();
|
||||
context = iD.coreContext().assetPath('../dist/').init();
|
||||
});
|
||||
|
||||
function createWay(tags) {
|
||||
|
||||
Reference in New Issue
Block a user