Sheriff-o-matic: Move BUILDING builder row to end

Fixes a regression introduced by sorting the result types by name.

Also a minor style tweak so the builder names stay aligned.

NOTRY=true

Review URL: https://codereview.chromium.org/406523004

git-svn-id: svn://svn.chromium.org/blink/trunk@178501 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e6c17c99
......@@ -58,29 +58,44 @@ var kExampleFailures = [{
module("ct-builder-grid");
asyncTest("basic", 7, function() {
var grid = document.createElement('ct-builder-grid');
grid.failures = kExampleFailures;
asyncTest("basic", 11, function() {
var oldBuildersInFlightForRevision = model.buildersInFlightForRevision;
var reset = function() {
model.buildersInFlightForRevision = oldBuildersInFlightForRevision;
}
Platform.endOfMicrotask(function() {
var rows = grid.shadowRoot.querySelectorAll('tbody tr');
equal(rows.length, 2);
try {
model.buildersInFlightForRevision = function(revision) {
return {'WebKit Mac10.7': {}};
};
var row1 = grid.shadowRoot.querySelector('tbody td.CRASH').parentNode;
equal(row1.children.length, 3);
equal(row1.children[1].querySelectorAll('ct-builder').length, 1);
equal(row1.children[1].querySelectorAll('ct-builder')[0].builderName, 'WebKit Mac10.7');
var grid = document.createElement('ct-builder-grid');
grid.failures = kExampleFailures;
requestAnimationFrame(function() {
reset();
var rows = grid.shadowRoot.querySelectorAll('tbody tr');
equal(rows.length, 3);
equal(row1.children[2].querySelectorAll('ct-builder').length, 2);
equal(row1.children[2].querySelectorAll('ct-builder')[0].builderName, 'WebKit Mac10.6 (dbg)');
equal(row1.children[2].querySelectorAll('ct-builder')[1].builderName, 'WebKit Win7 (dbg)');
var row1 = grid.shadowRoot.querySelector('tbody td.CRASH').parentNode;
equal(row1.children.length, 3);
equal(row1.children[1].querySelectorAll('ct-builder').length, 1);
equal(row1.children[1].querySelectorAll('ct-builder')[0].builderName, 'WebKit Mac10.7');
var row2 = grid.shadowRoot.querySelector('tbody td.TEXT').parentNode;
equal(row2.children.length, 3);
equal(row2.children[1].querySelectorAll('ct-builder').length, 1);
equal(row2.children[2].querySelectorAll('ct-builder').length, 1);
start();
});
equal(row1.children[2].querySelectorAll('ct-builder').length, 2);
equal(row1.children[2].querySelectorAll('ct-builder')[0].builderName, 'WebKit Mac10.6 (dbg)');
equal(row1.children[2].querySelectorAll('ct-builder')[1].builderName, 'WebKit Win7 (dbg)');
var row2 = grid.shadowRoot.querySelector('tbody td.TEXT').parentNode;
equal(row2.children.length, 3);
equal(row2.children[1].querySelectorAll('ct-builder').length, 1);
equal(row2.children[2].querySelectorAll('ct-builder').length, 1);
notEqual(rows[2].children[0].className.indexOf('BUILDING'), -1);
start();
});
} catch(e) {
reset();
}
});
})()
......
......@@ -27,11 +27,8 @@ found in the LICENSE file.
tbody td {
padding: 2px;
width: 40%;
}
tbody tr td:first-child {
vertical-align: top;
width: 40%;
}
tr :first-child span {
......@@ -79,7 +76,7 @@ found in the LICENSE file.
</tr>
</thead>
<tbody>
<template repeat="{{ type in resultTypes|keys }}">
<template repeat="{{ type in resultTypes|resultTypeKeys }}">
<tr>
<td class="{{ type }}">
<span>{{ type }}</span>
......@@ -112,6 +109,17 @@ found in the LICENSE file.
return Object.keys(obj).sort();
},
resultTypeKeys: function(obj) {
// Get the keys, but the BUILDING type should be last.
var keys = this.keys(obj);
var index = keys.indexOf('BUILDING');
if (index != -1) {
var buildingResult = keys.splice(index, 1);
keys.push(buildingResult[0]);
}
return keys;
},
failuresChanged: function() {
// Create a set of builders for each result type (e.g., text, crash).
this.resultTypes = {};
......@@ -131,7 +139,6 @@ found in the LICENSE file.
}).bind(this));
}, this);
// BUILDING builders should appear last.
var buildingType = this._getBuilding(passingRevisions);
if (!Object.isEmpty(buildingType))
this.resultTypes['BUILDING'] = buildingType;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment