2 Copyright 2014 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
7 <link rel="import" href="../bower_components/paper-icon-button/paper-icon-button.html">
9 <polymer-element name="ct-test-list" attributes="tests">
17 /* Be at least the height of a paper-icon-button.
18 So things line up nicely. */
27 vertical-align: middle;
30 paper-icon-button::shadow #icon {
34 <template repeat="{{ groups in testGroups_ }}">
35 <template if="{{ groups.tests.length }}">
36 <div><span style="font-weight: bold">Step:</span> {{ groups.step }}</div>
39 <template repeat="{{ group in groups.tests }}">
40 <!-- Case 1: single test failure -->
41 <template if="{{ group.name && (group.tests.length == 1 || group.expanded) }}">
42 <template repeat="{{ test in group.tests }}">
43 <div class="test-failures">
44 <a href="{{ test | flakinessDashboardURL }}">{{ test.testName }}</a>
48 <!-- Case 2: group of tests failed -->
49 <template if="{{ group.name && group.tests.length > 1 && !group.expanded }}">
50 <div class="test-failures">
51 {{ group.name }} ({{ group.tests.length }} Tests)
52 <paper-icon-button id="expand" icon="unfold-more" step="{{ groups.step }}" group="{{ group.name }}" on-click="{{ _expand }}"></paper-icon-button>
59 Polymer('ct-test-list', {
60 testsChanged: function() {
63 this.tests.forEach(function(test) {
64 if (!groups[test.step])
65 groups[test.step] = {};
66 var testName = test.reasonGroupName();
67 if (!groups[test.step][testName])
68 groups[test.step][testName] = [];
69 groups[test.step][testName].push(test);
72 this.testGroups_ = [];
73 Object.keys(groups, function(step, testsByName) {
75 Object.keys(testsByName, function(name, testList) {
76 if (name == 'undefined')
78 tests.push({'name': name, 'tests': testList, 'expanded': false});
81 this.testGroups_.push({'step': step, 'tests': tests});
83 this.testGroups_.sortBy('step');
86 _expand: function(evt) {
87 step = evt.target.attributes['step'].value;
88 name = evt.target.attributes['group'].value;
89 this.testGroups_.forEach(function(testGroup) {
90 if (testGroup.step == step) {
91 testGroup.tests.forEach(function(test) {
92 // FIXME: This attribute should be persisted over reloads.
93 if (test.name == name)
100 flakinessDashboardURL: function(test) {
101 return test.flakinessDashboardURL();