Skip to content
This repository was archived by the owner on Sep 20, 2019. It is now read-only.

Commit b062385

Browse files
committed
fix(labels): add tooltip support and fix tests
1 parent 9a5fd05 commit b062385

File tree

7 files changed

+58
-134
lines changed

7 files changed

+58
-134
lines changed

dist/ui-leaflet.js

Lines changed: 27 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-leaflet.min.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

dist/ui-leaflet.min.no-header.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

dist/ui-leaflet_dev_mapped.js

Lines changed: 27 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ui-leaflet_dev_mapped.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/directives/geojson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ angular.module('ui-leaflet')
3737
onEachFeature = geojson.onEachFeature;
3838
} else {
3939
onEachFeature = function(feature, layer) {
40-
if (isDefined(feature.properties.description)) {
40+
if (isDefined(feature.properties) && isDefined(feature.properties.description)) {
4141
layer.bindTooltip(feature.properties.description);
4242
}
4343

test/unit/markersDirectiveSpec.coffee

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -207,17 +207,6 @@ describe 'Directive: leaflet', ->
207207
expect(leafletMainMarker._popup._contentNode.innerHTML).toEqual '<p class="ng-binding">angular</p>'
208208

209209
it 'should bind label to main marker if message is given', (done) ->
210-
spyOn(leafletHelpers.LabelPlugin, 'isLoaded').and.returnValue true
211-
L.Label = L.Class.extend(includes: L.Mixin.Events)
212-
L.BaseMarkerMethods =
213-
bindLabel: (content, options) ->
214-
@label = new (L.Label)(options, this)
215-
@label._content = content
216-
this
217-
updateLabelContent: (content) ->
218-
@label._content = content
219-
220-
L.Marker.include L.BaseMarkerMethods
221210
marker =
222211
lat: 0.966
223212
lng: 2.02
@@ -233,14 +222,14 @@ describe 'Directive: leaflet', ->
233222
$rootScope.$digest()
234223
leafletData.getMarkers().then (leafletMarkers) ->
235224
leafletMainMarker = leafletMarkers.marker
236-
expect(leafletMainMarker.label._content).toEqual 'original'
225+
expect(leafletMainMarker.getTooltip()._content).toEqual 'original'
237226

238227
marker.label.message = 'new'
239228

240229
@digest $rootScope, ->
241230
leafletData.getMarkers().then (leafletMarkers) ->
242231
leafletMainMarker = leafletMarkers.marker
243-
expect(leafletMainMarker.label._content).toEqual 'new'
232+
expect(leafletMainMarker.getTooltip()._content).toEqual 'new'
244233
done()
245234

246235
# Markers

0 commit comments

Comments
 (0)