Skip to content

Commit

Permalink
fix(browser): fix hidden errors when the parent group already had suc…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
abe33 committed Jul 14, 2013
1 parent eec62aa commit edfbc73
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
29 changes: 23 additions & 6 deletions lib/browser_reporter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions src/browser_reporter.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
utils = spectacular.utils

ancestors = (node, block) ->
parent = node.parentNode

if hasClass parent, 'example-group'
block.call this, parent
ancestors parent, block

wrapNode = (node) ->
if node.length? then node else [node]
Expand Down Expand Up @@ -189,11 +195,11 @@ class spectacular.BrowserReporter
@formatProgressExample example

formatDocumentationExample: (example) ->
ancestors = example.ancestors
ancestors.pop()
elders = example.ancestors
elders.pop()

reversed = []
reversed.unshift a for a in ancestors
reversed.unshift a for a in elders

node = @examplesContainer
n = 0
Expand Down Expand Up @@ -251,13 +257,23 @@ class spectacular.BrowserReporter
}
"""


ex.onclick = -> toggleClass ex, 'closed'

node.appendChild ex
if example.failed
ancestors ex, (node) ->
if hasClass node, 'success'
removeClass node, 'success'
addClass node, 'failure'

pres = ex.querySelectorAll('pre:not([id])')
Array::forEach.call pres, (node) -> fixNodeHeight node
addClass ex, 'closed'
setTimeout (-> addClass ex, 'animate'), 100



formatProgressExample: (example) ->
id = @examples.length
ex = document.createElement 'article'
Expand Down

0 comments on commit edfbc73

Please sign in to comment.