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

Unified Diff: polymer_1.0.4/bower_components/iron-selector/test/next-previous.html

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 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.0.4/bower_components/iron-selector/test/next-previous.html
diff --git a/polymer_1.0.4/bower_components/iron-selector/test/next-previous.html b/polymer_1.0.4/bower_components/iron-selector/test/next-previous.html
new file mode 100644
index 0000000000000000000000000000000000000000..3a830c29157f29d444e849286793f6f0b13f93a3
--- /dev/null
+++ b/polymer_1.0.4/bower_components/iron-selector/test/next-previous.html
@@ -0,0 +1,134 @@
+<!doctype html>
+<!--
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+-->
+
+<html>
+<head>
+
+ <title>iron-selector-next-previous</title>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
+
+ <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
+ <script src="../../web-component-tester/browser.js"></script>
+ <script src="../../test-fixture/test-fixture-mocha.js"></script>
+
+ <link rel="import" href="../../test-fixture/test-fixture.html">
+ <link rel="import" href="../iron-selector.html">
+
+ <style>
+ .iron-selected {
+ background: #ccc;
+ }
+ </style>
+
+</head>
+<body>
+
+ <test-fixture id="test1">
+ <template>
+ <iron-selector selected="0">
+ <div>Item 0</div>
+ <div>Item 1</div>
+ <div>Item 2</div>
+ </iron-selector>
+ </template>
+ </test-fixture>
+
+ <test-fixture id="test2">
+ <template>
+ <iron-selector selected="foo" attr-for-selected="name">
+ <div name="foo">Item Foo</div>
+ <div name="bar">Item Bar</div>
+ <div name="zot">Item Zot</div>
+ </iron-selector>
+ </template>
+ </test-fixture>
+
+ <script>
+
+ var s;
+
+ function assertAndSelect(method, expectedIndex) {
+ assert.equal(s.selected, expectedIndex);
+ s[method]();
+ }
+
+ suite('next/previous', function() {
+
+ setup(function () {
+ s = fixture('test1');
+ });
+
+ test('selectNext', function() {
+ assert.equal(s.selected, 0);
+ assertAndSelect('selectNext', 0);
+ assertAndSelect('selectNext', 1);
+ assertAndSelect('selectNext', 2);
+ assert.equal(s.selected, 0);
+ });
+
+ test('selectPrevious', function() {
+ assert.equal(s.selected, 0);
+ assertAndSelect('selectPrevious', 0);
+ assertAndSelect('selectPrevious', 2);
+ assertAndSelect('selectPrevious', 1);
+ assert.equal(s.selected, 0);
+ });
+
+ test('selectNext/Previous', function() {
+ assert.equal(s.selected, 0);
+ assertAndSelect('selectNext', 0);
+ assertAndSelect('selectNext', 1);
+ assertAndSelect('selectPrevious', 2);
+ assertAndSelect('selectNext', 1);
+ assertAndSelect('selectPrevious', 2);
+ assert.equal(s.selected, 1);
+ });
+
+ });
+
+ suite('next/previous attrForSelected', function() {
+
+ setup(function () {
+ s = fixture('test2');
+ });
+
+ test('selectNext', function() {
+ assert.equal(s.selected, 'foo');
+ assertAndSelect('selectNext', 'foo');
+ assertAndSelect('selectNext', 'bar');
+ assertAndSelect('selectNext', 'zot');
+ assert.equal(s.selected, 'foo');
+ });
+
+ test('selectPrevious', function() {
+ assert.equal(s.selected, 'foo');
+ assertAndSelect('selectPrevious', 'foo');
+ assertAndSelect('selectPrevious', 'zot');
+ assertAndSelect('selectPrevious', 'bar');
+ assert.equal(s.selected, 'foo');
+ });
+
+ test('selectNext/Previous', function() {
+ assert.equal(s.selected, 'foo');
+ assertAndSelect('selectNext', 'foo');
+ assertAndSelect('selectNext', 'bar');
+ assertAndSelect('selectPrevious', 'zot');
+ assertAndSelect('selectNext', 'bar');
+ assertAndSelect('selectPrevious', 'zot');
+ assert.equal(s.selected, 'bar');
+ });
+
+ });
+
+ </script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698