Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pdevty/polymer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'static/bower_components/iron-selector/test/next-previous.html')
-rw-r--r--static/bower_components/iron-selector/test/next-previous.html134
1 files changed, 134 insertions, 0 deletions
diff --git a/static/bower_components/iron-selector/test/next-previous.html b/static/bower_components/iron-selector/test/next-previous.html
new file mode 100644
index 0000000..3a830c2
--- /dev/null
+++ b/static/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>