Sha256: 7d23ab25edaf06ae34bde8a9e0a5947aadd723c0e2aad004ce9c09844ee6b222
Contents?: true
Size: 1.25 KB
Versions: 12
Compression:
Stored size: 1.25 KB
Contents
class Teabag.Reporters.HTML.SpecView extends Teabag.Reporters.BaseView viewId = 0 constructor: (@spec, @reporter) -> @views = @reporter.views @spec.viewId = viewId += 1 @views.specs[@spec.viewId] = @ super build: -> classes = ["spec"] classes.push("state-pending") if @spec.pending super(classes.join(" ")) @el.innerHTML = """<a href="#{@spec.link}">#{@spec.description}</a>""" @parentView = @buildParent() @parentView.append(@el) buildParent: -> parent = @spec.parent if parent.viewId @views.suites[parent.viewId] else view = new Teabag.Reporters.HTML.SuiteView(parent, @reporter) @views.suites[view.suite.viewId] = view buildErrors: -> div = @createEl("div") html = "" for error in @spec.errors() html += """#{@htmlSafe(error.stack || error.message || "Stack trace unavailable")}""" div.innerHTML = html @append(div) updateState: (state, elapsed) -> result = @spec.result() classes = ["state-#{state}"] classes.push("slow") if elapsed > Teabag.slow @el.innerHTML += "<span>#{elapsed}ms</span>" unless state == "failed" @el.className = classes.join(" ") @buildErrors() unless result.status == "passed" @parentView.updateState?(state)
Version data entries
12 entries across 12 versions & 1 rubygems