polymer-neon-rails 1.0.0.pre.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/components/iron-flex-layout/README.md +4 -0
- data/app/assets/components/iron-flex-layout/bower.json +21 -0
- data/app/assets/components/iron-flex-layout/classes/iron-flex-layout.html +307 -0
- data/app/assets/components/iron-flex-layout/classes/iron-shadow-flex-layout.html +302 -0
- data/app/assets/components/iron-flex-layout/demo/index.html +40 -0
- data/app/assets/components/iron-flex-layout/demo/x-app.html +106 -0
- data/app/assets/components/iron-flex-layout/iron-flex-layout.html +313 -0
- data/app/assets/components/iron-meta/README.md +46 -0
- data/app/assets/components/iron-meta/bower.json +28 -0
- data/app/assets/components/iron-meta/demo/index.html +45 -0
- data/app/assets/components/iron-meta/hero.svg +33 -0
- data/app/assets/components/iron-meta/index.html +27 -0
- data/app/assets/components/iron-meta/iron-meta.html +352 -0
- data/app/assets/components/iron-meta/test/basic.html +48 -0
- data/app/assets/components/iron-meta/test/index.html +30 -0
- data/app/assets/components/iron-meta/test/iron-meta.html +186 -0
- data/app/assets/components/iron-resizable-behavior/README.md +16 -0
- data/app/assets/components/iron-resizable-behavior/bower.json +26 -0
- data/app/assets/components/iron-resizable-behavior/demo/index.html +29 -0
- data/app/assets/components/iron-resizable-behavior/demo/src/x-app.html +114 -0
- data/app/assets/components/iron-resizable-behavior/index.html +25 -0
- data/app/assets/components/iron-resizable-behavior/iron-resizable-behavior.html +139 -0
- data/app/assets/components/iron-resizable-behavior/test/basic.html +263 -0
- data/app/assets/components/iron-resizable-behavior/test/index.html +31 -0
- data/app/assets/components/iron-resizable-behavior/test/test-elements.html +143 -0
- data/app/assets/components/iron-selector/README.md +50 -0
- data/app/assets/components/iron-selector/bower.json +31 -0
- data/app/assets/components/iron-selector/demo/index.html +66 -0
- data/app/assets/components/iron-selector/index.html +28 -0
- data/app/assets/components/iron-selector/iron-multi-selectable.html +120 -0
- data/app/assets/components/iron-selector/iron-selectable.html +307 -0
- data/app/assets/components/iron-selector/iron-selection.html +115 -0
- data/app/assets/components/iron-selector/iron-selector.html +71 -0
- data/app/assets/components/iron-selector/test/activate-event.html +138 -0
- data/app/assets/components/iron-selector/test/basic.html +150 -0
- data/app/assets/components/iron-selector/test/content-element.html +43 -0
- data/app/assets/components/iron-selector/test/content.html +168 -0
- data/app/assets/components/iron-selector/test/index.html +36 -0
- data/app/assets/components/iron-selector/test/multi.html +135 -0
- data/app/assets/components/iron-selector/test/next-previous.html +134 -0
- data/app/assets/components/iron-selector/test/selected-attribute.html +72 -0
- data/app/assets/components/iron-selector/test/template-repeat.html +110 -0
- data/app/assets/components/neon-animation/README.md +304 -0
- data/app/assets/components/neon-animation/animations/cascaded-animation.html +84 -0
- data/app/assets/components/neon-animation/animations/fade-in-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/fade-out-animation.html +49 -0
- data/app/assets/components/neon-animation/animations/hero-animation.html +83 -0
- data/app/assets/components/neon-animation/animations/opaque-animation.html +46 -0
- data/app/assets/components/neon-animation/animations/ripple-animation.html +92 -0
- data/app/assets/components/neon-animation/animations/scale-down-animation.html +65 -0
- data/app/assets/components/neon-animation/animations/scale-up-animation.html +58 -0
- data/app/assets/components/neon-animation/animations/slide-down-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-from-left-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-from-right-animation.html +60 -0
- data/app/assets/components/neon-animation/animations/slide-left-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-right-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/slide-up-animation.html +59 -0
- data/app/assets/components/neon-animation/animations/transform-animation.html +61 -0
- data/app/assets/components/neon-animation/bower.json +51 -0
- data/app/assets/components/neon-animation/demo/declarative/index.html +108 -0
- data/app/assets/components/neon-animation/demo/doc/basic.html +47 -0
- data/app/assets/components/neon-animation/demo/doc/my-animatable.html +73 -0
- data/app/assets/components/neon-animation/demo/doc/my-dialog.html +97 -0
- data/app/assets/components/neon-animation/demo/doc/types.html +53 -0
- data/app/assets/components/neon-animation/demo/dropdown/animated-dropdown.html +97 -0
- data/app/assets/components/neon-animation/demo/dropdown/index.html +54 -0
- data/app/assets/components/neon-animation/demo/grid/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/grid/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/grid/index.html +70 -0
- data/app/assets/components/neon-animation/demo/index.html +6 -0
- data/app/assets/components/neon-animation/demo/list/full-view.html +122 -0
- data/app/assets/components/neon-animation/demo/list/index.html +29 -0
- data/app/assets/components/neon-animation/demo/list/list-demo.html +112 -0
- data/app/assets/components/neon-animation/demo/list/list-view.html +127 -0
- data/app/assets/components/neon-animation/demo/load/animated-grid.html +147 -0
- data/app/assets/components/neon-animation/demo/load/full-page.html +86 -0
- data/app/assets/components/neon-animation/demo/load/index.html +45 -0
- data/app/assets/components/neon-animation/demo/reprojection/animated-grid.html +166 -0
- data/app/assets/components/neon-animation/demo/reprojection/fullsize-page-with-card.html +124 -0
- data/app/assets/components/neon-animation/demo/reprojection/index.html +66 -0
- data/app/assets/components/neon-animation/demo/reprojection/reprojected-pages.html +42 -0
- data/app/assets/components/neon-animation/demo/shared.css +40 -0
- data/app/assets/components/neon-animation/demo/tiles/circles-page.html +110 -0
- data/app/assets/components/neon-animation/demo/tiles/index.html +77 -0
- data/app/assets/components/neon-animation/demo/tiles/squares-page.html +104 -0
- data/app/assets/components/neon-animation/guides/neon-animation.md +313 -0
- data/app/assets/components/neon-animation/index.html +30 -0
- data/app/assets/components/neon-animation/neon-animatable-behavior.html +156 -0
- data/app/assets/components/neon-animation/neon-animatable.html +54 -0
- data/app/assets/components/neon-animation/neon-animated-pages.html +208 -0
- data/app/assets/components/neon-animation/neon-animation-behavior.html +88 -0
- data/app/assets/components/neon-animation/neon-animation-runner-behavior.html +110 -0
- data/app/assets/components/neon-animation/neon-animation.html +17 -0
- data/app/assets/components/neon-animation/neon-animations.html +25 -0
- data/app/assets/components/neon-animation/neon-shared-element-animatable-behavior.html +37 -0
- data/app/assets/components/neon-animation/neon-shared-element-animation-behavior.html +66 -0
- data/app/assets/components/neon-animation/web-animations.html +11 -0
- data/app/assets/components/neon-elements/README.md +19 -0
- data/app/assets/components/neon-elements/bower.json +26 -0
- data/app/assets/components/paper-styles/README.md +3 -0
- data/app/assets/components/paper-styles/bower.json +27 -0
- data/app/assets/components/paper-styles/classes/global.html +96 -0
- data/app/assets/components/paper-styles/classes/shadow-layout.html +302 -0
- data/app/assets/components/paper-styles/classes/shadow.html +39 -0
- data/app/assets/components/paper-styles/classes/typography.html +171 -0
- data/app/assets/components/paper-styles/color.html +333 -0
- data/app/assets/components/paper-styles/default-theme.html +39 -0
- data/app/assets/components/paper-styles/demo-pages.html +72 -0
- data/app/assets/components/paper-styles/demo.css +25 -0
- data/app/assets/components/paper-styles/paper-styles-classes.html +14 -0
- data/app/assets/components/paper-styles/paper-styles.html +17 -0
- data/app/assets/components/paper-styles/shadow.html +61 -0
- data/app/assets/components/paper-styles/typography.html +240 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/web-animations-js/COPYING +202 -0
- data/app/assets/components/web-animations-js/History.md +108 -0
- data/app/assets/components/web-animations-js/README.md +161 -0
- data/app/assets/components/web-animations-js/bower.json +31 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next-lite.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations-next.min.js.map +1 -0
- data/app/assets/components/web-animations-js/web-animations.html +50 -0
- data/app/assets/components/web-animations-js/web-animations.min.js +17 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.gz +0 -0
- data/app/assets/components/web-animations-js/web-animations.min.js.map +1 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-neon-rails.rb +2 -0
- data/lib/polymer-neon-rails/engine.rb +4 -0
- data/lib/polymer-neon-rails/version.rb +3 -0
- metadata +264 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
<!--
|
2
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
3
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
4
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
5
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
6
|
+
Code distributed by Google as part of the polymer project is also
|
7
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
8
|
+
-->
|
9
|
+
|
10
|
+
<link rel="import" href="../iron-selector.html">
|
11
|
+
|
12
|
+
<dom-module id="test-content-element">
|
13
|
+
|
14
|
+
<template>
|
15
|
+
|
16
|
+
<iron-selector id="selector" selected="{{selected}}" selectable="[[selectable]]" attr-for-selected="id">
|
17
|
+
<content></content>
|
18
|
+
</iron-selector>
|
19
|
+
|
20
|
+
</template>
|
21
|
+
|
22
|
+
</dom-module>
|
23
|
+
|
24
|
+
<script>
|
25
|
+
|
26
|
+
Polymer({
|
27
|
+
|
28
|
+
is: 'test-content-element',
|
29
|
+
|
30
|
+
properties: {
|
31
|
+
|
32
|
+
selectable: String,
|
33
|
+
|
34
|
+
selected: {
|
35
|
+
type: String,
|
36
|
+
notify: true
|
37
|
+
}
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
});
|
42
|
+
|
43
|
+
</script>
|
@@ -0,0 +1,168 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<title>iron-selector-content</title>
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
17
|
+
|
18
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
<script src="../../web-component-tester/browser.js"></script>
|
20
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
23
|
+
<link rel="import" href="content-element.html">
|
24
|
+
|
25
|
+
<style>
|
26
|
+
.iron-selected {
|
27
|
+
background: #ccc;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
|
31
|
+
</head>
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<test-content-element id="selector1" selected="item0">
|
35
|
+
<div id="item0">item0</div>
|
36
|
+
<div id="item1">item1</div>
|
37
|
+
<div id="item2">item2</div>
|
38
|
+
<div id="item3">item3</div>
|
39
|
+
</test-content-element>
|
40
|
+
|
41
|
+
<test-content-element id="selector2" selected="item0" selectable="item">
|
42
|
+
<item id="item0">item0</item>
|
43
|
+
<hr>
|
44
|
+
<item id="item1">item1</item>
|
45
|
+
<item id="item2">item2</item>
|
46
|
+
<hr>
|
47
|
+
<item id="item3">item3</item>
|
48
|
+
</test-content-element>
|
49
|
+
|
50
|
+
<test-content-element id="selector3" selected="item0">
|
51
|
+
<template is="dom-repeat" id="t">
|
52
|
+
<div id$="[[item.name]]">[[item.name]]</div>
|
53
|
+
</template>
|
54
|
+
</test-content-element>
|
55
|
+
|
56
|
+
<script>
|
57
|
+
|
58
|
+
var s1 = document.querySelector('#selector1');
|
59
|
+
var s2 = document.querySelector('#selector2');
|
60
|
+
var s3 = document.querySelector('#selector3');
|
61
|
+
|
62
|
+
var t = document.querySelector('#t');
|
63
|
+
|
64
|
+
suite('content', function() {
|
65
|
+
|
66
|
+
test('attribute selected', function() {
|
67
|
+
// check selected class
|
68
|
+
assert.isTrue(s1.querySelector('#item0').classList.contains('iron-selected'));
|
69
|
+
});
|
70
|
+
|
71
|
+
test('set selected', function() {
|
72
|
+
// set selected
|
73
|
+
s1.selected = 'item1';
|
74
|
+
// check selected class
|
75
|
+
assert.isTrue(s1.querySelector('#item1').classList.contains('iron-selected'));
|
76
|
+
});
|
77
|
+
|
78
|
+
test('get items', function() {
|
79
|
+
assert.equal(s1.$.selector.items.length, 4);
|
80
|
+
});
|
81
|
+
|
82
|
+
test('activate event', function() {
|
83
|
+
var item = s1.querySelector('#item2');
|
84
|
+
item.dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
85
|
+
// check selected class
|
86
|
+
assert.isTrue(item.classList.contains('iron-selected'));
|
87
|
+
});
|
88
|
+
|
89
|
+
test('add item dynamically', function() {
|
90
|
+
var item = document.createElement('div');
|
91
|
+
item.id = 'item4';
|
92
|
+
item.textContent = 'item4';
|
93
|
+
Polymer.dom(s1).appendChild(item);
|
94
|
+
Polymer.dom.flush();
|
95
|
+
// set selected
|
96
|
+
s1.selected = 'item4';
|
97
|
+
// check items length
|
98
|
+
assert.equal(s1.$.selector.items.length, 5);
|
99
|
+
// check selected class
|
100
|
+
assert.isTrue(s1.querySelector('#item4').classList.contains('iron-selected'));
|
101
|
+
});
|
102
|
+
|
103
|
+
});
|
104
|
+
|
105
|
+
suite('content with selectable', function() {
|
106
|
+
|
107
|
+
test('attribute selected', function() {
|
108
|
+
// check selected class
|
109
|
+
assert.isTrue(s2.querySelector('#item0').classList.contains('iron-selected'));
|
110
|
+
});
|
111
|
+
|
112
|
+
test('set selected', function() {
|
113
|
+
// set selected
|
114
|
+
s2.selected = 'item1';
|
115
|
+
// check selected class
|
116
|
+
assert.isTrue(s2.querySelector('#item1').classList.contains('iron-selected'));
|
117
|
+
});
|
118
|
+
|
119
|
+
test('get items', function() {
|
120
|
+
assert.equal(s2.$.selector.items.length, 4);
|
121
|
+
});
|
122
|
+
|
123
|
+
test('activate event', function() {
|
124
|
+
var item = s2.querySelector('#item2');
|
125
|
+
item.dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
126
|
+
// check selected class
|
127
|
+
assert.isTrue(item.classList.contains('iron-selected'));
|
128
|
+
});
|
129
|
+
|
130
|
+
test('add item dynamically', function() {
|
131
|
+
var item = document.createElement('item');
|
132
|
+
item.id = 'item4';
|
133
|
+
item.textContent = 'item4';
|
134
|
+
Polymer.dom(s2).appendChild(item);
|
135
|
+
Polymer.dom.flush();
|
136
|
+
// set selected
|
137
|
+
s2.selected = 'item4';
|
138
|
+
// check items length
|
139
|
+
assert.equal(s2.$.selector.items.length, 5);
|
140
|
+
// check selected class
|
141
|
+
assert.isTrue(s2.querySelector('#item4').classList.contains('iron-selected'));
|
142
|
+
});
|
143
|
+
|
144
|
+
});
|
145
|
+
|
146
|
+
suite('content with dom-repeat', function() {
|
147
|
+
|
148
|
+
test('supports repeated children', function(done) {
|
149
|
+
t.items = [{name:'item0'}, {name: 'item1'}, {name: 'item2'}, {name: 'item3'}];
|
150
|
+
setTimeout(function() {
|
151
|
+
// check selected
|
152
|
+
assert.equal(s3.selected, 'item0');
|
153
|
+
// check selected class
|
154
|
+
assert.isTrue(s3.querySelector('#item0').classList.contains('iron-selected'));
|
155
|
+
// set selected
|
156
|
+
s3.selected = 'item2';
|
157
|
+
// check selected class
|
158
|
+
assert.isTrue(s3.querySelector('#item2').classList.contains('iron-selected'));
|
159
|
+
done();
|
160
|
+
});
|
161
|
+
});
|
162
|
+
|
163
|
+
});
|
164
|
+
|
165
|
+
</script>
|
166
|
+
|
167
|
+
</body>
|
168
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<meta charset="utf-8">
|
15
|
+
<title>Tests</title>
|
16
|
+
<script src="../../web-component-tester/browser.js"></script>
|
17
|
+
|
18
|
+
</head>
|
19
|
+
<body>
|
20
|
+
|
21
|
+
<script>
|
22
|
+
|
23
|
+
WCT.loadSuites([
|
24
|
+
'activate-event.html',
|
25
|
+
'basic.html',
|
26
|
+
'multi.html',
|
27
|
+
'next-previous.html',
|
28
|
+
'selected-attribute.html',
|
29
|
+
'template-repeat.html',
|
30
|
+
'content.html'
|
31
|
+
]);
|
32
|
+
|
33
|
+
</script>
|
34
|
+
|
35
|
+
</body>
|
36
|
+
</html>
|
@@ -0,0 +1,135 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<title>iron-selector-multi</title>
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
17
|
+
|
18
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
<script src="../../web-component-tester/browser.js"></script>
|
20
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
23
|
+
<link rel="import" href="../iron-selector.html">
|
24
|
+
|
25
|
+
<style>
|
26
|
+
.iron-selected {
|
27
|
+
background: #ccc;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
|
31
|
+
</head>
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<test-fixture id="test">
|
35
|
+
<template>
|
36
|
+
<iron-selector multi>
|
37
|
+
<div>Item 0</div>
|
38
|
+
<div>Item 1</div>
|
39
|
+
<div>Item 2</div>
|
40
|
+
<div>Item 3</div>
|
41
|
+
<div>Item 4</div>
|
42
|
+
</iron-selector>
|
43
|
+
</template>
|
44
|
+
</test-fixture>
|
45
|
+
|
46
|
+
<script>
|
47
|
+
|
48
|
+
suite('multi', function() {
|
49
|
+
|
50
|
+
var s;
|
51
|
+
|
52
|
+
setup(function () {
|
53
|
+
s = fixture('test');
|
54
|
+
});
|
55
|
+
|
56
|
+
test('honors the multi attribute', function() {
|
57
|
+
assert.isTrue(s.multi);
|
58
|
+
});
|
59
|
+
|
60
|
+
test('has sane defaults', function() {
|
61
|
+
assert.equal(s.selectedValues, undefined);
|
62
|
+
assert.equal(s.selectedClass, 'iron-selected');
|
63
|
+
assert.equal(s.items.length, 5);
|
64
|
+
});
|
65
|
+
|
66
|
+
test('set multi-selection via selected property', function() {
|
67
|
+
// set selectedValues
|
68
|
+
s.selectedValues = [0, 2];
|
69
|
+
// check selected class
|
70
|
+
assert.isTrue(s.children[0].classList.contains('iron-selected'));
|
71
|
+
assert.isTrue(s.children[2].classList.contains('iron-selected'));
|
72
|
+
// check selectedItems
|
73
|
+
assert.equal(s.selectedItems.length, 2);
|
74
|
+
assert.equal(s.selectedItems[0], s.children[0]);
|
75
|
+
assert.equal(s.selectedItems[1], s.children[2]);
|
76
|
+
});
|
77
|
+
|
78
|
+
test('set multi-selection via tap', function() {
|
79
|
+
// set selectedValues
|
80
|
+
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
81
|
+
s.children[2].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
82
|
+
// check selected class
|
83
|
+
assert.isTrue(s.children[0].classList.contains('iron-selected'));
|
84
|
+
assert.isTrue(s.children[2].classList.contains('iron-selected'));
|
85
|
+
// check selectedItems
|
86
|
+
assert.equal(s.selectedItems.length, 2);
|
87
|
+
assert.equal(s.selectedItems[0], s.children[0]);
|
88
|
+
assert.equal(s.selectedItems[1], s.children[2]);
|
89
|
+
});
|
90
|
+
|
91
|
+
test('fire iron-select/deselect events', function() {
|
92
|
+
// setup listener for iron-select event
|
93
|
+
var selectEventCounter = 0;
|
94
|
+
s.addEventListener('iron-select', function(e) {
|
95
|
+
selectEventCounter++;
|
96
|
+
});
|
97
|
+
// setup listener for core-deselect event
|
98
|
+
var deselectEventCounter = 0;
|
99
|
+
s.addEventListener('iron-deselect', function(e) {
|
100
|
+
deselectEventCounter++;
|
101
|
+
});
|
102
|
+
// tap to select an item
|
103
|
+
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
104
|
+
// check events
|
105
|
+
assert.equal(selectEventCounter, 1);
|
106
|
+
assert.equal(deselectEventCounter, 0);
|
107
|
+
// tap on already selected item should deselect it
|
108
|
+
s.children[0].dispatchEvent(new CustomEvent('tap', {bubbles: true}));
|
109
|
+
// check selectedValues
|
110
|
+
assert.equal(s.selectedValues.length, 0);
|
111
|
+
// check class
|
112
|
+
assert.isFalse(s.children[0].classList.contains('iron-selected'));
|
113
|
+
// check events
|
114
|
+
assert.equal(selectEventCounter, 1);
|
115
|
+
assert.equal(deselectEventCounter, 1);
|
116
|
+
});
|
117
|
+
|
118
|
+
/* test('toggle multi from true to false', function() {
|
119
|
+
// set selected
|
120
|
+
s.selected = [0, 2];
|
121
|
+
var first = s.selected[0];
|
122
|
+
// set mutli to false, so to make it single-selection
|
123
|
+
s.multi = false;
|
124
|
+
// selected should not be an array
|
125
|
+
assert.isNotArray(s.selected);
|
126
|
+
// selected should be the first value from the old array
|
127
|
+
assert.equal(s.selected, first);
|
128
|
+
}); */
|
129
|
+
|
130
|
+
});
|
131
|
+
|
132
|
+
</script>
|
133
|
+
|
134
|
+
</body>
|
135
|
+
</html>
|
@@ -0,0 +1,134 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<!--
|
3
|
+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
+
Code distributed by Google as part of the polymer project is also
|
8
|
+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
+
-->
|
10
|
+
|
11
|
+
<html>
|
12
|
+
<head>
|
13
|
+
|
14
|
+
<title>iron-selector-next-previous</title>
|
15
|
+
<meta charset="utf-8">
|
16
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
17
|
+
|
18
|
+
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
19
|
+
<script src="../../web-component-tester/browser.js"></script>
|
20
|
+
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
21
|
+
|
22
|
+
<link rel="import" href="../../test-fixture/test-fixture.html">
|
23
|
+
<link rel="import" href="../iron-selector.html">
|
24
|
+
|
25
|
+
<style>
|
26
|
+
.iron-selected {
|
27
|
+
background: #ccc;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
|
31
|
+
</head>
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<test-fixture id="test1">
|
35
|
+
<template>
|
36
|
+
<iron-selector selected="0">
|
37
|
+
<div>Item 0</div>
|
38
|
+
<div>Item 1</div>
|
39
|
+
<div>Item 2</div>
|
40
|
+
</iron-selector>
|
41
|
+
</template>
|
42
|
+
</test-fixture>
|
43
|
+
|
44
|
+
<test-fixture id="test2">
|
45
|
+
<template>
|
46
|
+
<iron-selector selected="foo" attr-for-selected="name">
|
47
|
+
<div name="foo">Item Foo</div>
|
48
|
+
<div name="bar">Item Bar</div>
|
49
|
+
<div name="zot">Item Zot</div>
|
50
|
+
</iron-selector>
|
51
|
+
</template>
|
52
|
+
</test-fixture>
|
53
|
+
|
54
|
+
<script>
|
55
|
+
|
56
|
+
var s;
|
57
|
+
|
58
|
+
function assertAndSelect(method, expectedIndex) {
|
59
|
+
assert.equal(s.selected, expectedIndex);
|
60
|
+
s[method]();
|
61
|
+
}
|
62
|
+
|
63
|
+
suite('next/previous', function() {
|
64
|
+
|
65
|
+
setup(function () {
|
66
|
+
s = fixture('test1');
|
67
|
+
});
|
68
|
+
|
69
|
+
test('selectNext', function() {
|
70
|
+
assert.equal(s.selected, 0);
|
71
|
+
assertAndSelect('selectNext', 0);
|
72
|
+
assertAndSelect('selectNext', 1);
|
73
|
+
assertAndSelect('selectNext', 2);
|
74
|
+
assert.equal(s.selected, 0);
|
75
|
+
});
|
76
|
+
|
77
|
+
test('selectPrevious', function() {
|
78
|
+
assert.equal(s.selected, 0);
|
79
|
+
assertAndSelect('selectPrevious', 0);
|
80
|
+
assertAndSelect('selectPrevious', 2);
|
81
|
+
assertAndSelect('selectPrevious', 1);
|
82
|
+
assert.equal(s.selected, 0);
|
83
|
+
});
|
84
|
+
|
85
|
+
test('selectNext/Previous', function() {
|
86
|
+
assert.equal(s.selected, 0);
|
87
|
+
assertAndSelect('selectNext', 0);
|
88
|
+
assertAndSelect('selectNext', 1);
|
89
|
+
assertAndSelect('selectPrevious', 2);
|
90
|
+
assertAndSelect('selectNext', 1);
|
91
|
+
assertAndSelect('selectPrevious', 2);
|
92
|
+
assert.equal(s.selected, 1);
|
93
|
+
});
|
94
|
+
|
95
|
+
});
|
96
|
+
|
97
|
+
suite('next/previous attrForSelected', function() {
|
98
|
+
|
99
|
+
setup(function () {
|
100
|
+
s = fixture('test2');
|
101
|
+
});
|
102
|
+
|
103
|
+
test('selectNext', function() {
|
104
|
+
assert.equal(s.selected, 'foo');
|
105
|
+
assertAndSelect('selectNext', 'foo');
|
106
|
+
assertAndSelect('selectNext', 'bar');
|
107
|
+
assertAndSelect('selectNext', 'zot');
|
108
|
+
assert.equal(s.selected, 'foo');
|
109
|
+
});
|
110
|
+
|
111
|
+
test('selectPrevious', function() {
|
112
|
+
assert.equal(s.selected, 'foo');
|
113
|
+
assertAndSelect('selectPrevious', 'foo');
|
114
|
+
assertAndSelect('selectPrevious', 'zot');
|
115
|
+
assertAndSelect('selectPrevious', 'bar');
|
116
|
+
assert.equal(s.selected, 'foo');
|
117
|
+
});
|
118
|
+
|
119
|
+
test('selectNext/Previous', function() {
|
120
|
+
assert.equal(s.selected, 'foo');
|
121
|
+
assertAndSelect('selectNext', 'foo');
|
122
|
+
assertAndSelect('selectNext', 'bar');
|
123
|
+
assertAndSelect('selectPrevious', 'zot');
|
124
|
+
assertAndSelect('selectNext', 'bar');
|
125
|
+
assertAndSelect('selectPrevious', 'zot');
|
126
|
+
assert.equal(s.selected, 'bar');
|
127
|
+
});
|
128
|
+
|
129
|
+
});
|
130
|
+
|
131
|
+
</script>
|
132
|
+
|
133
|
+
</body>
|
134
|
+
</html>
|