From 06e96cc3469510efd6f827c2f37bbe4e072a1256 Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Mon, 11 Feb 2013 20:23:42 -0800 Subject: [PATCH] Fold failed specs on click --- spec/atom-reporter.coffee | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index d28ad4466..92030753e 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -24,20 +24,7 @@ class AtomReporter extends View @timeoutId: 0 reportRunnerStarting: (runner) -> - $(document).on "mouseover", ".spec-summary", ({srcElement}) => - element = $(srcElement) - description = element.data("description") - return unless description - - clearTimeout @timeoutId if @timeoutId? - @specPopup.show() - @specPopup.text description - {left, top} = element.offset() - left += 20 - top += 20 - @specPopup.offset({left, top}) - @timeoutId = setTimeout((=> @specPopup.hide()), 3000) - + @handleEvents() @startedAt = new Date() specs = runner.specs() @totalSpecCount = specs.length @@ -73,6 +60,26 @@ class AtomReporter extends View else @specFilter(parent) + handleEvents: -> + $(document).on "mouseover", ".spec-summary", ({currentTarget}) => + element = $(currentTarget) + description = element.data("description") + return unless description + + clearTimeout @timeoutId if @timeoutId? + @specPopup.show() + @specPopup.text description + {left, top} = element.offset() + left += 20 + top += 20 + @specPopup.offset({left, top}) + @timeoutId = setTimeout((=> @specPopup.hide()), 3000) + + $(document).on "click", ".suite", ({currentTarget}) => + element = $(currentTarget) + element.find(".spec").toggle() + false + updateStatusView: (spec) -> if @failedCount > 0 @status.addClass('failed') unless @status.hasClass('failed')