PolymerElements / iron-selector

Manages a list of elements that can be selected
32 stars 55 forks source link

Fire event when fallback selection is triggered #137

Closed TimvdLippe closed 6 years ago

TimvdLippe commented 8 years ago

This event can be used in an application element to create a monolithic 404 fallback as a routing method.

An example usage of this event can be found in this diff: https://github.com/TimvdLippe/polymer-lazy-application/compare/monolithic-router?expand=1#diff-8177f8e50fd6fc8e66434f5c76f38d98R45 Here you can listen for the event and based on that handle just one 404 page. This usecase is also described in https://github.com/PolymerElements/app-route/issues/126

cc @rictic

TimvdLippe commented 8 years ago

Friendly ping. The Travis failure is due to Selenium failing on Firefox.

rictic commented 8 years ago

This LGTM. @bicknellr to do final review.

bicknellr commented 8 years ago

This needs some tests, otherwise LGTM.

TimvdLippe commented 8 years ago

Added a test and documentation :tada:. I first wanted the feedback on this approach before fully implementing the feature.

TimvdLippe commented 8 years ago

I have updated the tests with the new assertions. Instead of asserting on items[0], it asserts on undefined. If an item is not found and there is no fallback selection, the expected behavior is like the old behavior: do not select an item.

TimvdLippe commented 7 years ago

@bicknellr Because these events are triggered a lot more, which means that almost all of the time the check is redundant. This is simply a performance win + a more clearer event name to explain the intent.

TimvdLippe commented 6 years ago

This PR is very old and I am no longer pursuing this change. Therefore I am closing this PR.