Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: polymer_1.2.3/bower_components/iron-selector/test/multi.html

Issue 1581713003: [third_party] add polymer 1.2.3 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: 1.2.3 Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_1.2.3/bower_components/iron-selector/test/multi.html
diff --git a/polymer_1.0.4/bower_components/iron-selector/test/multi.html b/polymer_1.2.3/bower_components/iron-selector/test/multi.html
similarity index 66%
copy from polymer_1.0.4/bower_components/iron-selector/test/multi.html
copy to polymer_1.2.3/bower_components/iron-selector/test/multi.html
index fdc31c716e698d260347c6a1915878f9cf4acecf..2000d2ce520ada976dd2b2f6c68c8781d0715003 100644
--- a/polymer_1.0.4/bower_components/iron-selector/test/multi.html
+++ b/polymer_1.2.3/bower_components/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() {
@@ -51,6 +66,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
setup(function () {
s = fixture('test');
+ t = Polymer.dom(s).querySelector('[is="dom-repeat"]');
});
test('honors the multi attribute', function() {
@@ -115,6 +131,63 @@ 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('updates selection when dom changes', function(done) {
+ var selectEventCounter = 0;
+
+ s = fixture('test');
+
+ Polymer.Base.async(function() {
+ var firstChild = Polymer.dom(s).querySelector(':first-child');
+ var lastChild = Polymer.dom(s).querySelector(':last-child');
+
+ MockInteractions.tap(firstChild);
+ MockInteractions.tap(lastChild);
+
+ expect(s.selectedItems.length).to.be.equal(2);
+
+ Polymer.dom(s).removeChild(lastChild);
+
+ Polymer.Base.async(function() {
+ expect(s.selectedItems.length).to.be.equal(1);
+ done();
+ });
+ });
+
+ });
+
/* test('toggle multi from true to false', function() {
// set selected
s.selected = [0, 2];

Powered by Google App Engine
This is Rietveld 408576698