Sha256: 22d4f74247a026e13b19ced1a281c1717533bd0c56cf52831de21a4161317870

Contents?: true

Size: 888 Bytes

Versions: 3

Compression:

Stored size: 888 Bytes

Contents

window.Everqueen = Everqueen = {}

Everqueen.Test = (element) ->
  self = this
  @element = $(element)
  @runLink = @element.find(".run")
  @runLink.click ->
    self.run()
    false

Everqueen.Test::run = ->
  self = this
  @iframe = $("<iframe></iframe>").attr("src", @runLink.attr("href")).appendTo(@element)
  @iframe.css
    position: "absolute"
    left: "-20000px"

  @runLink.addClass("running").text "Running…"
  $(@iframe).load ->
    context = self.iframe.get(0).contentWindow
    innerQUnit = context.QUnit
    innerQUnit.done (results) ->
      self.done results

Everqueen.Test::done = (results) ->
  @runLink.removeClass "running"
  if results.failed > 0
    @runLink.addClass("fail").removeClass("pass").text "Fail"
  else
    @runLink.addClass("pass").removeClass("fail").text "Pass"
  @iframe.remove()

$ ->
  $("#tests li, #all").each ->
    new Everqueen.Test(this)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
everqueen-1.1.1 lib/everqueen/assets/list.js.coffee
everqueen-1.1.0 lib/everqueen/assets/list.js.coffee
everqueen-1.0.1 lib/everqueen/assets/list.js.coffee