      1 if (Widgets === undefined) {
      2   var Widgets = {};
      3 };
      4
      5 Widgets.testProgressWidget = function (options) {
      6   var passed = true;
      7
      8   var that = {
      9     increment: function() {
     10       options.model.value += options.increment;
     11       options.assistant.controller.modelChanged(options.model, options.assistant);
     12     },
     13
     14     finishedWith: function(results) {
     15       if (results.passed()) {
     16         options.model.title = 'All ' + results.passedCount + ' Expectations Passed';
     17       } else {
     18         options.model.title = results.failedCount + ' of ' + results.totalCount + ' Expectations Failed';
     19       }
     20       options.assistant.controller.modelChanged(options.model, options.assistant);
     21     },
     22
     23     displayOnFail: function () {
     24       if (passed) {
     25         passed = false;
     26         options.assistant.controller.get(options.widgetId).querySelector('.download-pill-background').className += ' fail';
     27       }
     28     }
     29   };
     30
     31   options.assistant.controller.setupWidget(options.widgetId, {cancellable: false}, options.model);
     32   return that;
     33 };
     34
     35