Changeset 93254 in webkit


Ignore:
Timestamp:
Aug 17, 2011 3:51:55 PM (13 years ago)
Author:
Dimitri Glazkov
Message:

garden-o-matic Summary view should have items in descending chronological order.
https://bugs.webkit.org/show_bug.cgi?id=66403

Reviewed by Adam Barth.

  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js: Renamed "push" to "add" for clarity, cleaned up some stuff.
  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Rewrote add to insert DOM elements in order.
  • BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Added unit tests.
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js

    r93161 r93254  
    3636    // FIXME: This should be a button with a progress element.
    3737    var updating = new ui.notifications.Info("Updating ...");
    38     g_info.push(updating);
     38    g_info.add(updating);
    3939
    4040    // FIXME: Also provide information on bot failures.
     
    4444            var failure = g_testFailures.get(key);
    4545            if (!failure) {
    46                 failure = g_actions.push(new ui.notifications.TestFailures());
     46                failure = new ui.notifications.TestFailures();
    4747                model.commitDataListForRevisionRange(failureAnalysis.newestPassingRevision + 1, failureAnalysis.oldestFailingRevision).forEach(function(commitData) {
    4848                    failure.addCommitData(commitData);
    4949                });
     50                g_actions.add(failure);
    5051            }
    5152            failure.addFailureAnalysis(failureAnalysis);
     
    6566    document.body.insertBefore(g_info, document.body.firstChild);
    6667    var button = document.body.insertBefore(document.createElement("button"), document.body.firstChild);
    67     button.addEventListener("click", function()
    68     {
    69         update();
    70     }, false);
     68    button.addEventListener("click", update);
    7169    button.textContent = 'update';
    7270    update();
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js

    r93252 r93254  
    3434        this.className = 'notifications';
    3535    },
    36     push: function(notification)
     36    add: function(notification)
    3737    {
    38         // FIXME: Add in descending time order.
    39         this.insertBefore(notification, this.firstChild);
     38        var insertBefore = null;
     39        Array.prototype.some.call(this.children, function(existingNotification) {
     40            if (existingNotification.index() < notification.index()) {
     41                insertBefore = existingNotification;
     42                return true;
     43            }
     44        });
     45        this.insertBefore(notification, insertBefore);
    4046        return notification;
    4147    }
    4248});
    4349
    44 var Notification = base.extends('li', {
     50ui.notifications.Notification = base.extends('li', {
    4551    init: function()
    4652    {
    4753        this._what = this.appendChild(document.createElement('div'));
    4854        this._what.className = 'what';
     55        this._index = 0;
    4956        $(this).hide().fadeIn('fast');
     57    },
     58    index: function()
     59    {
     60        return this._index;
     61    },
     62    setIndex: function(index)
     63    {
     64        this._index = index;
    5065    },
    5166    dismiss: function()
     
    5974});
    6075
    61 ui.notifications.Info = base.extends(Notification, {
     76ui.notifications.Info = base.extends(ui.notifications.Notification, {
    6277    init: function(message)
    6378    {
     
    119134});
    120135
    121 ui.notifications.TestFailures = base.extends(Notification, {
     136ui.notifications.TestFailures = base.extends(ui.notifications.Notification, {
    122137    init: function()
    123138    {
     
    129144        this._causes = problem.appendChild(document.createElement('ul'));
    130145        this._causes.className = 'causes';
     146    },
     147    date: function()
     148    {
     149        return this._time.date;
    131150    },
    132151    containsFailureAnalysis: function(failureAnalysis)
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js

    r93241 r93254  
    2828module('ui.notifications');
    2929
    30 test('ui.notifications.Stream', 5, function() {
     30test('ui.notifications.Notification', 5, function() {
     31    var notification = new ui.notifications.Notification();
     32    equal(notification.tagName, 'LI');
     33    equal(notification.innerHTML, '<div class="what"></div>');
     34    equal(notification.index(), 0);
     35    notification.setIndex(1);
     36    equal(notification.index(), 1);
     37    // FIXME: Really need to figure out how to mock/test animated removal.
     38    ok(notification.dismiss);
     39});
     40
     41test('ui.notifications.Stream', 11, function() {
    3142    var stream = new ui.notifications.Stream();
    3243    equal(stream.tagName, 'OL');
    3344    equal(stream.className, 'notifications');
    34     stream.push(document.createElement('li')).textContent = 'o-matic';
     45    equal(stream.childElementCount, 0);
     46
     47    var notification;
     48
     49    notification = new ui.notifications.Info('-o-matic');
     50    notification.setIndex(2);
     51    stream.add(notification);
    3552    equal(stream.childElementCount, 1);
    36     stream.push(document.createElement('li')).textContent = 'garden-';
     53    equal(stream.textContent, '-o-matic');
     54
     55    notification = new ui.notifications.Info('garden');
     56    notification.setIndex(3);
     57    stream.add(notification);
    3758    equal(stream.childElementCount, 2);
    3859    equal(stream.textContent, 'garden-o-matic');
     60
     61    notification = new ui.notifications.Info(' is ');
     62    notification.setIndex(1);
     63    stream.add(notification);
     64    equal(stream.childElementCount, 3);
     65    equal(stream.textContent, 'garden-o-matic is ');
     66
     67    notification = new ui.notifications.Info('awesome!');
     68    stream.add(notification);
     69    equal(stream.childElementCount, 4);
     70    equal(stream.textContent, 'garden-o-matic is awesome!');
    3971});
    4072
    41 test('ui.notifications.Info', 3, function() {
     73test('ui.notifications.Info', 2, function() {
    4274    var info = new ui.notifications.Info('info');
    4375    equal(info.tagName, 'LI');
    4476    equal(info.innerHTML, '<div class="what">info</div>');
    45     // FIXME: Really need to figure out how to mock/test animated removal.
    46     ok(info.dismiss);
    4777});
    4878
  • trunk/Tools/ChangeLog

    r93252 r93254  
     12011-08-17  Dimitri Glazkov  <dglazkov@chromium.org>
     2
     3        garden-o-matic Summary view should have items in descending chronological order.
     4        https://bugs.webkit.org/show_bug.cgi?id=66403
     5
     6        Reviewed by Adam Barth.
     7
     8        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/summary.js: Renamed "push" to "add" for clarity, cleaned up some stuff.
     9        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js: Rewrote add to insert DOM elements in order.
     10        * BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js: Added unit tests.
     11
    1122011-08-17  Dimitri Glazkov  <dglazkov@chromium.org>
    213
Note: See TracChangeset for help on using the changeset viewer.