-
Notifications
You must be signed in to change notification settings - Fork 592
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
Store initial map interaction settings #696
Store initial map interaction settings #696
Conversation
Just a note here that I'm aware that this test 👇 fails, but the code there works on the "debug" map. |
@alexgleith Thanks for this PR. Sorry for the slow reply. This is a great idea. It would be good to have a test that confirms we're tracking all the right values in mapbox-gl. I don't think these are going to change, but having the test suite fail if they do will be really helpful. Per the failing tests, our tests use mapbox-gl-js-mock and it looks like some of these options aren't mocked out there. We should probably rethink how we do this testing, but that can be a different PR. |
Hey @mcwhittemore, thanks for the feedback. I get what your saying about the options in the mock thingy. But I'm not really sure how to handle it. If I were to get this PR working with all the interaction switchers (like |
@alexgleith - As long as the tests are passing and the functionality is complete this will merge pretty quickly after the final PR. That said, I don't have much time right now to help clear up the failing tests. |
@mcwhittemore, ok, so I should address the failing tests as part of the PR then, even though they are failing for the wrong reasons? |
@alexgleith - yea. Tests aren't failing on master, so its the additions in this PR that are breaking the test suite. That needs to be resolved before being brought into master. |
…able. Included comments." This reverts commit 816aef3.
Hey @mcwhittemore, I think this is ready to go. |
Thanks for this @alexgleith. Can you add one automated test to confirm that this feature works. I want to know that we won't regress on this. |
Hey @mcwhittemore, I think this will be really hard to do a test for. For example, to test it properly, we should really do the following:
This sounds reasonable, but the MapBoxGL Mock object doesn't do half of these things... so to test, it means either creating my own mock process, or improving the upstream one. I'll have a look at just checking the two functions |
…lexgleith/mapbox-gl-draw into store-initial-map-interaction-settings
Hey @mcwhittemore, I've implemented one set of tests, and that was very useful because it did highlight a bug already (doh!). I'm still unsure on how to mock up removing the draw control, so that we can test whether that part works. I've tested it in the debug app, though, and we're solid 👍. |
Thanks @alexgleith! This has been merged and published to NPM in v1.0.4 |
const store = new Store(ctx); | ||
store.storeMapConfig(); | ||
// Check we can get the initial state of it | ||
console.log(store); |
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.
Hi! I noticed this on my test output.
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.
Oh, crap. This is already merged. Should I create another PR to fix?
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.
That would be great. Thanks! Can you look at adding no console.log to the eslint config as well?
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 has been done, see: #716
Hey, this is a first draft of a change, which is intended to enable storage and consistent setting of map interaction settings when enabling Draw.
There's a couple of concepts in here:
setup.js
using the Storedouble_click_zoom.js
file and tested in the debug map and works well.This PR is really a first pass, where I'm hoping to get feedback on the concept. After feedback I'll finish implementation for the other interactions.
I have an issue between the develop mode interactive site and the tests, in that the store and map are different, so either one or the other fails. This may be (probably is) my fault, so feedback in how to handle that would be appreciated.
This is affecting a app I'm building, so I'm keen to work on a fix now =).