OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <polymer-element name="chart-title" attributes="seriesGroupList"> | 8 <dom-module id="chart-title"> |
9 <template> | 9 <template> |
10 <style> | 10 <style> |
11 .title { | 11 .title { |
12 color: #424242; | 12 color: #424242; |
13 text-decoration: none; | 13 text-decoration: none; |
14 } | 14 } |
15 | 15 |
16 .title:hover { | 16 .title:hover { |
17 color: #4184f3; | 17 color: #4184f3; |
18 text-decoration: underline; | 18 text-decoration: underline; |
19 } | 19 } |
20 | 20 |
21 .title[disabled] { | 21 .title[disabled] { |
22 color: #8d8d8d; | 22 color: #8d8d8d; |
23 text-decoration: none; | 23 text-decoration: none; |
24 cursor: default; | 24 cursor: default; |
25 } | 25 } |
26 </style> | 26 </style> |
27 | 27 |
28 <h3> | 28 <h3> |
29 <template repeat="{{part, partIndex in titleParts}}"> | 29 <template is="dom-repeat" items="{{part, partIndex in titleParts}}" as="pa
rt" index-as="partIndex"> |
30 <a class="title disabled" href="javascript:void(0);" | 30 <a class="title disabled" href="javascript:void(0);" |
31 on-click="{{onClicked}}" disabled?="{{partIndex == currentIndex}}" | 31 on-click="onClicked" disabled$="{{computeStrictEqual(partIndex, curre
ntIndex}}" |
32 class="title"> | 32 class="title"> |
33 {{part}} | 33 {{part}} |
34 </a> | 34 </a> |
35 <span hidden?="{{partIndex == titleParts.length - 1}}">/</span> | 35 <span hidden$="{{computeIsLast(partIndex, titleParts)}}">/</span> |
36 </template> | 36 </template> |
37 </h3> | 37 </h3> |
38 <div> | 38 <div> |
39 <template repeat="{{info in suiteDescriptions}}"> | 39 <template is="dom-repeat" items="{{suiteDescriptions}}" as="info"> |
40 <div><b>{{info.suite}}</b>: {{info.description}}</div> | 40 <div><b>{{info.suite}}</b>: {{info.description}}</div> |
41 </template> | 41 </template> |
42 </div> | 42 </div> |
43 | 43 |
44 </template> | 44 </template> |
45 <script> | 45 <script> |
46 'use strict'; | 46 'use strict'; |
47 Polymer('chart-title', { | 47 Polymer({ |
| 48 |
| 49 is: 'chart-title', |
| 50 properties: { |
| 51 seriesGroupList: { notify: true } |
| 52 }, |
| 53 |
| 54 computeIsLast: (idx, arr) => idx === arr.length - 1, |
| 55 computeStrictEqual: (a, b) => a === b, |
48 | 56 |
49 /** | 57 /** |
50 * Sets the title of the chart based on the current state of the chart. | 58 * Sets the title of the chart based on the current state of the chart. |
51 */ | 59 */ |
52 update: function() { | 60 update: function() { |
53 var testPaths = this.getTestPaths(); | 61 var testPaths = this.getTestPaths(); |
54 var title = this.makeTitleFromTestPaths(testPaths); | 62 var title = this.makeTitleFromTestPaths(testPaths); |
55 var selectedSeries = this.getFirstSelectedSeries(); | 63 var selectedSeries = this.getFirstSelectedSeries(); |
56 | 64 |
57 var parts = title.split('/'); | 65 var parts = title.split('/'); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 for (var i = 1; i < arrays.length; i++) { | 188 for (var i = 1; i < arrays.length; i++) { |
181 if (arrays[i][prefixLength] != value) { | 189 if (arrays[i][prefixLength] != value) { |
182 return arrays[0].slice(0, prefixLength); | 190 return arrays[0].slice(0, prefixLength); |
183 } | 191 } |
184 } | 192 } |
185 } | 193 } |
186 return arrays[0].slice(0, shortestLength); | 194 return arrays[0].slice(0, shortestLength); |
187 } | 195 } |
188 }); | 196 }); |
189 </script> | 197 </script> |
190 </polymer-element> | 198 </dom-module> |
OLD | NEW |