Sha256: ade5cf0c94fd585c0b2c1bc5cb43cb26035c518d5fb50680c56b3d1a82333b7d

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

#= require moment
#= require sinon-timers

#= require_self
#= require_directory .

LocalTime.TestHelpers =
  assert: QUnit.assert
  testGroup: QUnit.module
  test: QUnit.test

  testAsync: (name, callback) ->
    QUnit.test name, (assert) ->
      done = assert.async()
      callback(done)

  addTimeEl: ({format, type, datetime} = {}) ->
    format ?= "%Y"
    type ?= "time"
    datetime ?= "2013-11-12T12:13:00Z"

    el = document.createElement "time"
    el.setAttribute "data-local", type
    el.setAttribute "data-format", format
    el.setAttribute "datetime", datetime
    document.body.appendChild el
    el

  setText: (el, text) ->
    el.textContent = text

  getText: (el) ->
    # innerHTML works in all browsers so using it ensures we're
    # reading the text content, not a potentially arbitrary property.
    el.innerHTML

  triggerEvent: (name, el = document) ->
    event = document.createEvent "Events"
    event.initEvent name, true, true
    el.dispatchEvent event

  defer: (callback) ->
    setTimeout(callback, 1)

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/local_time-2.1.0/test/javascripts/src/test.coffee
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/local_time-2.1.0/test/javascripts/src/test.coffee
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/local_time-2.1.0/test/javascripts/src/test.coffee
local_time-2.1.0 test/javascripts/src/test.coffee
local_time-2.0.1 test/javascripts/src/test.coffee
local_time-2.0.0 test/javascripts/src/test.coffee