Allow search with lat/lon null
See #284
LGTM. Mind writing a test?
I think it would be better if the code never throws. It should just ignore invalid values (maybe output something in the console).
@ukabu While outputting something in the console would be okay, I think throwing is a better way to ensure clarity upon failure and allow an application to catch and deal with the error, which could go back to user input, without having to test for the problem.
Regardless, I'm not going to change the precedent here.
The problem is that the throw happens for the wrong reason. If the longitude is not set (initial state) and then you set the latitude, it is going to throw with invalid longitude (it's still null).
This happens if you set the lat and lon using the geo-location web component. Initially, the lat and lon are null. When you get the geo-location, the latitude is set first which cause the throw before the longitude has any chance of being set.
If any throw should occur, it should be in the setter of the specific property instead and validate only that property. It should not be in the _updateLocation function.
The location is set via a single lat/lon object and the listener for that object doesn't look at the fields. As such, it shouldn't be hard to avoid a state where latitude is set and longitude isn't.
EDIT: I take it back, the location field can't be used for setting, so yeah, having it throw because you trigger a binding with this.latitude = value.y; this.longitude = value.x; is super annoying. Perhaps the && should simply be changed to an ||? I still don't think we should allow any falsey value.
Hmm, I'm trying to write tests for this, but it seems tests that do certain processing trip the new key requirement and fail on an InvalidKeyMapError. Any suggestions on that?