Index: lib/src/iron-selector/test/multi.html |
diff --git a/lib/src/iron-selector/test/multi.html b/lib/src/iron-selector/test/multi.html |
index fdc31c716e698d260347c6a1915878f9cf4acecf..1fef10b4ae3d847fb2da43eadb9cfa8db4b03f1c 100644 |
--- a/lib/src/iron-selector/test/multi.html |
+++ b/lib/src/iron-selector/test/multi.html |
@@ -20,6 +20,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
<script src="../../test-fixture/test-fixture-mocha.js"></script> |
<link rel="import" href="../../test-fixture/test-fixture.html"> |
+ <link rel="import" href="../../iron-test-helpers/iron-test-helpers.html"> |
<link rel="import" href="../iron-selector.html"> |
<style> |
@@ -43,6 +44,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
</template> |
</test-fixture> |
+ <!-- |
+ NOTE(cdata): Enable test-fixture when polymer/polymer#2495 is resolved |
+ --> |
+ <!--<test-fixture id="repeatedItems"> |
+ <template>--> |
+ <iron-selector multi id="repeatedItems"> |
+ <template is="dom-repeat" items='["foo", "bar", "baz"]'> |
+ <div>[[item]]</div> |
+ </template> |
+ <div>vim</div> |
+ </iron-selector> |
+ <!--</template> |
+ </test-fixture>--> |
+ |
<script> |
suite('multi', function() { |
@@ -115,6 +130,39 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN |
assert.equal(deselectEventCounter, 1); |
}); |
+ test('fires selected-values-changed when selection changes', function() { |
+ var selectedValuesChangedEventCounter = 0; |
+ |
+ s.addEventListener('selected-values-changed', function(e) { |
+ selectedValuesChangedEventCounter++; |
+ }); |
+ |
+ MockInteractions.tap(Polymer.dom(s).children[0]); |
+ MockInteractions.tap(Polymer.dom(s).children[0]); |
+ MockInteractions.tap(Polymer.dom(s).children[0]); |
+ |
+ expect(selectedValuesChangedEventCounter); |
+ }); |
+ |
+ test('selects from items created by dom-repeat', function(done) { |
+ var selectEventCounter = 0; |
+ var firstChild; |
+ |
+ s = document.querySelector('#repeatedItems'); |
+ s.addEventListener('iron-select', function(e) { |
+ selectEventCounter++; |
+ }); |
+ |
+ // NOTE(cdata): I guess `dom-repeat` doesn't stamp synchronously.. |
+ Polymer.Base.async(function() { |
+ firstChild = Polymer.dom(s).querySelector('div'); |
+ MockInteractions.tap(firstChild); |
+ |
+ assert.equal(s.selectedItems[0].textContent, 'foo'); |
+ done(); |
+ }); |
+ }); |
+ |
/* test('toggle multi from true to false', function() { |
// set selected |
s.selected = [0, 2]; |