Sha256: f24685538fd0fe1445fc4a8ca3cbdd1c11d6d4ab6824adb2edbb683acb068189

Contents?: true

Size: 1017 Bytes

Versions: 6

Compression:

Stored size: 1017 Bytes

Contents

class Teabag.Reporters.HTML.SuiteView extends Teabag.Reporters.BaseView

  viewId = 0

  constructor: (@suite, @reporter) ->
    @views = @reporter.views
    @suite.viewId = viewId += 1
    @views.suites[@suite.viewId] = @
    @suite = new Teabag.Reporters.NormalizedSuite(suite)
    super


  build: ->
    super("suite")
    @el.innerHTML = """<h1><a href="#{@suite.link}">#{@suite.description}</a></h1>"""
    @parentView = @buildParent()
    @parentView.append(@el)


  buildParent: ->
    parent = @suite.parent
    return @reporter unless parent
    if parent.viewId
      @views.suites[parent.viewId]
    else
      view = new Teabag.Reporters.HTML.SuiteView(parent, @reporter)
      @views.suites[view.suite.viewId] = view


  append: (el) ->
    super(@ol = @createEl("ol")) unless @ol
    @ol.appendChild(el)


  updateState: (state) ->
    return if @state == "failed"
    @el.className = "#{@el.className.replace(/\s?state-\w+/, "")} state-#{state}"
    @parentView.updateState?(state)
    @state = state

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
teabag-0.3.5 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee
teabag-0.3.4 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee
teabag-0.3.3 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee
teabag-0.3.2 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee
teabag-0.3.1 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee
teabag-0.3.0 app/assets/javascripts/teabag/base/reporters/html/suite_view.coffee