Sha256: 24732ab0f1a9cf86ab8275350f9b9373481a5dd110fa02f04396430ecdb40b82

Contents?: true

Size: 1.07 KB

Versions: 13

Compression:

Stored size: 1.07 KB

Contents

#= require teaspoon/reporters/html/base_view

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.resolveClass("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.resolveClass("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

13 entries across 13 versions & 1 rubygems

Version Path
teaspoon-1.4.0 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.2.2 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.2.1 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.2.0 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.5 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.4 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.3 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.2 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.1 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.1.0 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.0.2 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.0.1 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee
teaspoon-1.0.0 app/assets/javascripts/teaspoon/reporters/html/suite_view.coffee