Sha256: a527f98df0f80c9a3ab5ccc6c8528c0d9fc4acbe783811ed6eee7ed36c24bff9

Contents?: true

Size: 1017 Bytes

Versions: 1

Compression:

Stored size: 1017 Bytes

Contents

class Teaspoon.Reporters.HTML.SuiteView extends Teaspoon.Reporters.BaseView

  viewId = 0

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


  build: ->
    super("suite")
    @el.innerHTML = """<h1><a href="#{@suite.link}">#{@htmlSafe(@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 Teaspoon.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

1 entries across 1 versions & 1 rubygems

Version Path
teaspoon-0.9.1 app/assets/javascripts/teaspoon/base/reporters/html/suite_view.coffee