Skip to content

Commit

Permalink
Extracted L to a module and created dummy implementation for fastboot
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarizu committed Oct 26, 2016
1 parent a980908 commit 88941c7
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 20 deletions.
35 changes: 35 additions & 0 deletions addon/L.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/* global L */

let L_ = null;

if (typeof L !== 'undefined') {
L_ = L;
} else {
let N = () => {};

L_ = {
Icon: { Default: {} },

circle: N,
circleMarker: N,
divIcon: N,
geoJson: N,
imageOverlay: N,
latLng: N,
latLngBounds: N,
map: N,
marker: N,
point: N,
polygon: N,
polyline: N,
popup: N,
tileLayer: N,
tooltip: N,
version: N
};

L_.tileLayer.wms = N;
}

export default L_;

2 changes: 1 addition & 1 deletion addon/components/base-layer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Ember from 'ember';
import { ChildMixin } from 'ember-composability-tools';
import { InvokeActionMixin } from 'ember-invoke-action';
/* global L */
import L from 'ember-leaflet/L';

const { assert, computed, Component, run, K, A, String: { classify } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/div-icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/icon.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/lat-lng-bounds.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion addon/helpers/point.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Ember from 'ember';
/* global L */
import L from 'ember-leaflet/L';

const { Helper: { helper } } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion app/initializers/leaflet-assets.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ENV from '../config/environment';
/* global L */
import L from 'ember-leaflet/L';

export function initialize(/* container, application */) {
L.Icon.Default.imagePath = `${ENV.rootURL || ENV.baseURL || '/'}assets/images/`;
Expand Down
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ module.exports = {
included: function(app) {
this._super.included.apply(this, arguments);

if (process.env.EMBER_CLI_FASTBOOT) {
return;
}

// If the addon has the _findHost() method (in ember-cli >= 2.7.0), we'll just
// use that.
if (typeof this._findHost === 'function') {
Expand All @@ -23,7 +27,7 @@ module.exports = {
do {
app = current.app || app;
} while (current.parent.parent && (current = current.parent));

//import javascript
app.import(app.bowerDirectory + '/leaflet/dist/leaflet-src.js');

Expand Down
2 changes: 1 addition & 1 deletion tests/assertions/bounds-contain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global L */
import L from 'ember-leaflet/L';

export default function boundsContain(bounds1, bounds2, msg = 'Bounds 1 doesn\'t contain bounds 2') {
// use this.push to add the assertion.
Expand Down
3 changes: 2 additions & 1 deletion tests/helpers/locations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global L */
import L from 'ember-leaflet/L';

export default {
nyc: L.latLng(40.713282, -74.006978),
sf: L.latLng(37.77493, -122.419415),
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/geojson-layer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertionInjector, assertionCleanup } from '../../assertions';
import GeoJSONLayerComponent from 'ember-leaflet/components/geojson-layer';
import locations from '../../helpers/locations';
import sampleGeoJSON from '../../helpers/sample-geojson';
/* globals L */
import L from 'ember-leaflet/L';

const emptyGeoJSON = {
type: 'FeatureCollection',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/leaflet-map-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import hbs from 'htmlbars-inline-precompile';
import { assertionInjector, assertionCleanup } from '../../assertions';
import LeafletMapComponent from 'ember-leaflet/components/leaflet-map';
import locations from '../../helpers/locations';
/* global L */
import L from 'ember-leaflet/L';

let map;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/marker-collection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import wait from 'ember-test-helpers/wait';
import { assertionInjector, assertionCleanup } from '../../assertions';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { run } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/marker-layer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { assertionInjector, assertionCleanup } from '../../assertions';
import hasEmberVersion from 'ember-test-helpers/has-ember-version';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

//Needed to silence leaflet autodetection error
L.Icon.Default.imagePath = 'some-path';
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/popup-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import wait from 'ember-test-helpers/wait';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import ArrayPathLayerComponent from 'ember-leaflet/components/array-path-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { computed, run, A } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/components/tooltip-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import wait from 'ember-test-helpers/wait';
import MarkerLayerComponent from 'ember-leaflet/components/marker-layer';
import ArrayPathLayerComponent from 'ember-leaflet/components/array-path-layer';
import locations from '../../helpers/locations';
/* globals L */
import L from 'ember-leaflet/L';

const { computed, run, A } = Ember;

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/div-icon-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { divIcon } from 'dummy/helpers/div-icon';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | div-icon');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/icon-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { icon } from 'dummy/helpers/icon';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | icon');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/lat-lng-bounds-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { latLngBounds } from 'dummy/helpers/lat-lng-bounds';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | lat-lng-bounds');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/helpers/point-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { point } from 'dummy/helpers/point';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

module('Unit | Helper | point');

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/initializers/leaflet-assets-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Ember from 'ember';
import ENV from '../../../config/environment';
import { initialize } from '../../../initializers/leaflet-assets';
import { module, test } from 'qunit';
/* global L */
import L from 'ember-leaflet/L';

const { run, Application } = Ember;

Expand Down

0 comments on commit 88941c7

Please sign in to comment.