-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The Great Tests Crusade #98
The Great Tests Crusade #98
Conversation
:D 👍 |
@twokul @gabesmed Any idea on how we can test template and view lookups?
Looks like the App/container created by |
Only the following tests are missing:
We currently don't have |
}); | ||
this._popupView.createElement(); | ||
this._popupView.$().appendTo(self._popup._contentNode); | ||
this._popup.update(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a delicate part.
Simple tests are passing, but I would like to know if there is a better way to do this.
@miguelcobain we should probably move the code from |
@miguelcobain @gabesmed we need to decide if we want to expose things like |
Right now we are just exposing them as layers (normal Ember classes). What would be the advantage of exposing them as components? |
{{#ember-leaflet}}
{{ember-leaflet-tile}}
{{ember-leaflet-tile}}
{{ember-leaflet-tile}}
{{/ember-leaflet}} |
OUCH. That would render dom structure, for sure. Dealing with changes and Suggestion: keep the current class system and create additional components that wrap each class:
This is assuming we take the DOM approach. |
really neat idea @twokul, definitely see that components are the way ember is moving. however it might get very hard to create complex customizations inside HTML. Would this be ember idiomatic? How would you customize properties and create computed calculations?
also @miguelcobain has a good point that this would end up creating DOM, which we'd then have to parse and eliminate. ewww. maybe we could move all configuration away from declaring classes into like a json object.
In any case, we should definitely consider interfaces changes in a separate thread from the es6 module port. Let's keep this a straight port without changing functionality just to pull off the bandaid ASAP. After this is done it'll be much easier to do branches and consider alternate interfaces |
{{#ember-leaflet}}
{{tile-layer url="...." optionA="something"}}
{{#collection-layer}}
{{#each marker in controller.markers}}
{{marker-layer locationProp=marker.loc}}
{{/each}}
{{/collection-layer}}
{{polygon-layer radius=50 center=controller.center}}
{{/ember-leaflet}} Maybe a bit more "idiomatic". Agree with getting this port done and taking this to the next stage. |
Guys, check my branch: https://github.com/miguelcobain/ember-leaflet/tree/component-render I've managed to render a map like this: {{#ember-leaflet}}
{{#if tileEnabled}}
{{tile-layer tileUrl="//a.tiles.mapbox.com/v3/examples.map-zr0njcqy/{z}/{x}/{y}.png"}}
{{/if}}
{{#container-layer}}
{{#each location in enabledLocations}}
{{marker-layer location=location.location}}
{{/each}}
{{/container-layer}}
{{/ember-leaflet}}
{{#ember-leaflet}}
{{#if tileEnabled}}
{{tile-layer tileUrl="//a.tiles.mapbox.com/v3/examples.map-zr0njcqy/{z}/{x}/{y}.png"}}
{{/if}}
{{#container-layer}}
{{#container-layer}}
{{#container-layer}}
{{#each location in enabledLocations}}
{{marker-layer location=location.location}}
{{/each}}
{{/container-layer}}
{{/container-layer}}
{{/container-layer}}
{{/ember-leaflet}} It is just a quick proof of concept, but it's definitely doable!!! |
@miguelcobain Love that template! 👍 Though as @gabesmed suggests, it is worth its own PR. |
@miguelcobain looks good dude |
@codefox421 oh, absolutely. |
I think I'm dropping support for marker clusters. This is a leaflet plugin. It could be packaged as an ember-leaflet addon later. Do we agree? |
After reading this: emberjs/ember.js#5534 |
Is there any way to include it without EmberLeaflet as a whole relying on the markercluster plugin? as in it throws an error if you try to use the markercluster functionality without including the plugin, but the entire library won't crash? think it's a pretty commonly used plugin, and I selfishly need it for my use case :) |
It is possible to detect its presence and throw an error if someone tries to use our class without importing the plugin. I never used this plugin, though maybe I should have. :) |
I'd prefer that if it doesn't cause too much trouble. But open to overrulling -- not a big deal either way. :) I see the argument for clean-ness, but also think ember-leaflet is maybe too small a library to start having plugins of its own. regarding the popupView, don't we just use ember's DOM functionality? don't see how this wouldn't still work -- we're just basically copying the view's DOM element? |
The popup appears correctly. Also, a lot has changed. That code you mentioned currently throws:
Looks like this._popupView.createElement();
this._popup.setContent(this._popupView.element);
this._popup.update(); But this doesn't pass the tests. The template doesn't update. :/ Need some help here to either make this work or decide an alternative solution if we conclude this doesn't work anymore. |
@miguelcobain ok i'm looking into popup view test...maybe i can help |
@miguelcobain hm, looks like it's partially working. see how the first test is failing, but the second test is succeeding, and how the updated marker shows the #20? (i manually added a looks like the for loop in the template is updating just fine. it's the if statement that isn't working |
good news is this means the basic approach works? bad news is now we need to debug the if statement specifically. alllllmost there!! |
TESTS PASSING :D -- is this all the tests ported over now @miguelcobain cc @twokul |
Hey Guys, have you seen the approach in https://github.com/jerel/poc, more specific jerel/poc#1 (comment)? For me his code works really well. Rendering content in a popup is rather simple using that code |
Another thing to consider is that with HTMLBars you can let Ember render an element whereever it likes on the page, then move it somewhere else, and Ember will continue to update it as if it never was moved. This wasn't possible before because of those metamorph script tags Handlebars injected everywhere. |
@codefox421 : yeah that is the exact approach which is used by @jerel. |
@ssured The current implementation only uses one private API call as well. |
@miguelcobain I put up my code on github. It is not very polished but does the job. See https://github.com/ssured/ember-cli-leaflet. https://github.com/ssured/ember-cli-leaflet/blob/master/addon/components/leaf-base.js exposes an attach and detach method, which get implemented for several UI elements supplied by Leaflet, see for example https://github.com/ssured/ember-cli-leaflet/blob/master/addon/components/leaf-ilayer.js#L24-L49. This is the same pattern pointed out by jerel/poc#1 (comment). There is a demo app living in the gh-pages branch. http://ssured.github.io/ember-cli-leaflet/ Does this align with your project? |
Definitely. I think adding a component rendering logic to the existing codebase shouldn't be too hard. |
Added tests for:
They're green! Loads of fun!
Don't merge yet. I'll do the rest tomorrow.