Changeset 93254 in webkit
- Timestamp:
- Aug 17, 2011 3:51:55 PM (13 years ago)
- 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 36 36 // FIXME: This should be a button with a progress element. 37 37 var updating = new ui.notifications.Info("Updating ..."); 38 g_info. push(updating);38 g_info.add(updating); 39 39 40 40 // FIXME: Also provide information on bot failures. … … 44 44 var failure = g_testFailures.get(key); 45 45 if (!failure) { 46 failure = g_actions.push(new ui.notifications.TestFailures());46 failure = new ui.notifications.TestFailures(); 47 47 model.commitDataListForRevisionRange(failureAnalysis.newestPassingRevision + 1, failureAnalysis.oldestFailingRevision).forEach(function(commitData) { 48 48 failure.addCommitData(commitData); 49 49 }); 50 g_actions.add(failure); 50 51 } 51 52 failure.addFailureAnalysis(failureAnalysis); … … 65 66 document.body.insertBefore(g_info, document.body.firstChild); 66 67 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); 71 69 button.textContent = 'update'; 72 70 update(); -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications.js
r93252 r93254 34 34 this.className = 'notifications'; 35 35 }, 36 push: function(notification)36 add: function(notification) 37 37 { 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); 40 46 return notification; 41 47 } 42 48 }); 43 49 44 varNotification = base.extends('li', {50 ui.notifications.Notification = base.extends('li', { 45 51 init: function() 46 52 { 47 53 this._what = this.appendChild(document.createElement('div')); 48 54 this._what.className = 'what'; 55 this._index = 0; 49 56 $(this).hide().fadeIn('fast'); 57 }, 58 index: function() 59 { 60 return this._index; 61 }, 62 setIndex: function(index) 63 { 64 this._index = index; 50 65 }, 51 66 dismiss: function() … … 59 74 }); 60 75 61 ui.notifications.Info = base.extends( Notification, {76 ui.notifications.Info = base.extends(ui.notifications.Notification, { 62 77 init: function(message) 63 78 { … … 119 134 }); 120 135 121 ui.notifications.TestFailures = base.extends( Notification, {136 ui.notifications.TestFailures = base.extends(ui.notifications.Notification, { 122 137 init: function() 123 138 { … … 129 144 this._causes = problem.appendChild(document.createElement('ul')); 130 145 this._causes.className = 'causes'; 146 }, 147 date: function() 148 { 149 return this._time.date; 131 150 }, 132 151 containsFailureAnalysis: function(failureAnalysis) -
trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/TestFailures/scripts/ui/notifications_unittests.js
r93241 r93254 28 28 module('ui.notifications'); 29 29 30 test('ui.notifications.Stream', 5, function() { 30 test('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 41 test('ui.notifications.Stream', 11, function() { 31 42 var stream = new ui.notifications.Stream(); 32 43 equal(stream.tagName, 'OL'); 33 44 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); 35 52 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); 37 58 equal(stream.childElementCount, 2); 38 59 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!'); 39 71 }); 40 72 41 test('ui.notifications.Info', 3, function() {73 test('ui.notifications.Info', 2, function() { 42 74 var info = new ui.notifications.Info('info'); 43 75 equal(info.tagName, 'LI'); 44 76 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);47 77 }); 48 78 -
trunk/Tools/ChangeLog
r93252 r93254 1 2011-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 1 12 2011-08-17 Dimitri Glazkov <dglazkov@chromium.org> 2 13
Note: See TracChangeset
for help on using the changeset viewer.