4
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8
Code distributed by Google as part of the polymer project is also
9
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
15
<title>paper-tabs-attr-for-selected</title>
16
<meta charset="utf-8">
17
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
19
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
20
<script src="../../web-component-tester/browser.js"></script>
22
<link rel="import" href="../paper-tabs.html">
27
<test-fixture id="basic">
29
<paper-tabs attr-for-selected="name" selected="bar">
30
<paper-tab name="foo">ITEM FOO</paper-tab>
31
<paper-tab name="bar">ITEM BAR</paper-tab>
32
<paper-tab name="zot">ITEM ZOT</paper-tab>
39
suite('set the selected attribute', function() {
44
tabs = fixture('basic');
47
test('selected value', function() {
48
assert.equal(tabs.selected, 'bar');
51
test('selected tab has iron-selected class', function() {
53
assert.isTrue(tabs.querySelector('[name=bar]').classList.contains('iron-selected'));
58
suite('select tab via click', function() {
63
tabs = fixture('basic');
64
tab = tabs.querySelector('[name=zot]');
65
tab.dispatchEvent(new CustomEvent('click', {bubbles: true}));
68
test('selected value', function() {
69
assert.equal(tabs.selected, 'zot');
72
test('selected tab has iron-selected class', function() {
74
assert.isTrue(tab.classList.contains('iron-selected'));