diff --git a/src/control.js b/src/control.js index e49fbe5..2fdca98 100644 --- a/src/control.js +++ b/src/control.js @@ -810,7 +810,12 @@ export const Elevation = L.Control.Elevation = L.Control.extend({ this.import(this.__D3).then(() => { this._initMapIntegrations(layer); - this._fireEvt("eledata_loaded", { data: geojson, layer: layer, name: this.track_info.name, track_info: this.track_info }); + const event_data = { data: geojson, layer: layer, name: this.track_info.name, track_info: this.track_info }; + if (this._modulesLoaded) { + this._fireEvt("eledata_loaded", event_data); + } else { + this.once('modules_loaded', () => this._fireEvt("eledata_loaded", event_data)); + } }); return layer; diff --git a/test/setup/http_server.js b/test/setup/http_server.js index ac4b858..92a0f1d 100644 --- a/test/setup/http_server.js +++ b/test/setup/http_server.js @@ -47,6 +47,7 @@ export function suite() { test.before(setup); test.after(reset); test.before.each(async ({ localhost, page }) => { + page.on('console', msg => console.log(msg.text())) await page.goto((new URL(arguments[0], localhost)).toString()); }); // augment uvu `test` function with a third parameter `timeout`