From 5bca55b6444ded62e6cec5b876a9035e46b274af Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Fri, 7 Aug 2015 15:20:34 -0700 Subject: [PATCH] Add tests. Reset selection on items/multi change. Remove async. --- src/lib/template/array-selector.html | 21 +-- test/runner.html | 1 + test/unit/array-selector-elements.html | 11 ++ test/unit/array-selector.html | 218 +++++++++++++++++++++++++ 4 files changed, 237 insertions(+), 14 deletions(-) create mode 100644 test/unit/array-selector-elements.html create mode 100644 test/unit/array-selector.html diff --git a/src/lib/template/array-selector.html b/src/lib/template/array-selector.html index 5e30a7c7a8..ec3011e381 100644 --- a/src/lib/template/array-selector.html +++ b/src/lib/template/array-selector.html @@ -73,7 +73,8 @@ * An array containing items from which selection will be made. */ items: { - type: Array + type: Array, + observer: '_resetSelection' }, /** @@ -99,15 +100,11 @@ */ multi: { type: Boolean, - value: false + observer: '_resetSelection' } }, - observers: [ - '_itemsChanged(items, multi)' - ], - - _itemsChanged: function(items, multi) { + _resetSelection: function() { // Unbind previous selection if (Array.isArray(this.selected)) { for (var i=0; i +Polymer({ + is: 'observe-el', + observers: [ + 'singleChanged(singleSelected.*)', + 'multiChanged(multiSelected.*)' + ], + singleChanged: function() {}, + multiChanged: function() {} +}); + diff --git a/test/unit/array-selector.html b/test/unit/array-selector.html new file mode 100644 index 0000000000..31ee18f2d3 --- /dev/null +++ b/test/unit/array-selector.html @@ -0,0 +1,218 @@ + + + + + + + + + + + + + + + + + + + + + + +