      1 if (Widgets === undefined) {
      2   var Widgets = {};
      3 }
      4
      5 Widgets.ErrorListWidget = function (options, templatePath) {
      6   options.listTemplate = templatePath !== undefined ? templatePath + 'test/suite' : 'test/suite';
      7   options.itemTemplate = templatePath !== undefined ? templatePath + 'test/result' : 'test/result';
      8
      9   Widgets.ResultListWidget.call(this, options, templatePath);
     10 };
     11 Widgets.ErrorListWidget.inheritsFrom(Widgets.ResultListWidget);
     12
     13 Widgets.ErrorListWidget.prototype.addSpecResult = function(spec) {
     14   this.addItemToList(this.formatResult(spec));
     15 };
     16
     17 Widgets.ErrorListWidget.prototype.show = function() {
     18   this.options.assistant.controller.get(this.options.widgetId).style.display = 'block';
     19 };
     20
     21 Widgets.ErrorListWidget.prototype.hide = function() {
     22   this.options.assistant.controller.get(this.options.widgetId).style.display = 'none';
     23 };
     24
     25 Widgets.ErrorListWidget.prototype.formatResult = function(spec) {
     26   var result = spec.results;
     27   return {
     28     spec: spec,
     29     cssClass: result.passed() ? 'passed' : 'failed',
     30     specDescription: spec.getFullName()
     31   };
     32 };
     33