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

fix(Markers): fix marker icon broken with latest Leaflet version (1.0) #299

Merged
merged 1 commit into from
Sep 29, 2016

Conversation

ValentinH
Copy link
Contributor

Leaflet now tries to auto-detect the path for the icons, but when using a base64 one, it breaks.
Thus, we need to force the imagePath to be ' '.
See this line in Leaflet source: https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Icon.Default.js#L36

Broken demo: http://jsfiddle.net/ar2bo629/
Fixed Demo: http://jsfiddle.net/f7bq9v6b/

Leaflet now tries to auto-detect the path for the icons, but when using a base64 one, it breaks.
Thus, we need to force the imagePath to be ' '.
See this line in Leaflet source: https://github.com/Leaflet/Leaflet/blob/master/src/layer/marker/Icon.Default.js#L36
@nmccready
Copy link
Contributor

Anyway you can add a spec to assert this fix stay around?

Copy link
Contributor

@nmccready nmccready left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests to make sure base64 icons work.

@ValentinH
Copy link
Contributor Author

Where should I add this test?

@nmccready
Copy link
Contributor

@ValentinH
Copy link
Contributor Author

coffeescript? 😢
Is there a way where I can add tests in JS?

@nmccready
Copy link
Contributor

coffeescript? 😢
Is there a way where I can add tests in JS?

Seriously?, coffee is not much different then js, learn something new please. Otherwise add a leafletMarkersHelpersSpec.js file and ill convert it.

Coffee is not end of the world.

@elesdoar
Copy link
Contributor

elesdoar commented Sep 28, 2016

@ValentinH don't worry, you can write test in JS, but the new ES6 or ES7 looks like Coffee, but keep in coffee tests that are in coffee.

You could use http://js2.coffee/

@ValentinH
Copy link
Contributor Author

Sorry, I was a bit trolling! 👿

But I think that having tests in Coffeescript is not really good to encourage new contributors to provide tests with their PR. Indeed, Coffeescript is not really use anymore today...

@ValentinH
Copy link
Contributor Author

Don't worry, I will do it in coffee when I have some time.

@elesdoar
Copy link
Contributor

elesdoar commented Sep 28, 2016

I think that we have to go ES6 or ES7, but change all coffee specs requires a lot of work.

@ValentinH if you want you can translate this test to JS, but takes full advantages of ES6.

@ValentinH
Copy link
Contributor Author

What do you mean by take full advantages?

@elesdoar
Copy link
Contributor

@ValentinH
Sorry for my bad explanation, it's so hard write in english. jaajaja... 😢

I mean that use arrow functions, template strings, classes, etc. Obviously where needed.
Please check http://es6-features.org

@nmccready
Copy link
Contributor

I think the master branch already supports babel, so you can write ES6 there. I just prefer Coffee for specs cause its a whole lot less hassel for nested bracket and variable declaration. Plus I wrote a lot of the specs and to get them done fast I chose coffee.

I still don't think ES6 is like coffee at all the arrow function means something much different in ES6 since you cant call apply or call to pass a different this on a function. Anyway, I could go on but ES6 is better for sure since it has structuring and destructuring.

@ValentinH
Copy link
Contributor Author

Actually, I don't know how to test this. Currently, there is no test for marker/icon creations so I can't really understand from where to start. Thus, I wont' add test in this PR.

@elesdoar
Copy link
Contributor

elesdoar commented Sep 29, 2016

OK, I'll merging the change and I'll do this test.

Thanks @ValentinH

@elesdoar elesdoar merged commit 446d768 into angular-ui:leaflet-1.X Sep 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants