Sha256: 2c5062c860efb18ff1a88648426f0f8913905a92983abba96c94975f306efe37

Contents?: true

Size: 559 Bytes

Versions: 11

Compression:

Stored size: 559 Bytes

Contents

u = up.util
e = up.element
$ = jQuery

beforeEach ->
  jasmine.addMatchers
    toHaveOpacity: (util, customEqualityTesters) ->
      compare: (element, expectedOpacity, tolerance = 0.0) ->
        element = e.get(element)
        actualOpacity = e.styleNumber(element, 'opacity')
        result = {}
        result.pass =  Math.abs(expectedOpacity - actualOpacity) <= tolerance
        unless result.pass
          result.message = up.log.sprintf("Expected %o to have opacity %o, but it was %o", element, expectedOpacity, actualOpacity)
        return result

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
unpoly-rails-1.0.3 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-1.0.1 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-1.0.0 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.62.1 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.62.0 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.61.1 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.61.0 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.60.3 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.60.2 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.60.1 spec_app/spec/javascripts/helpers/to_have_opacity.coffee
unpoly-rails-0.60.0 spec_app/spec/javascripts/helpers/to_have_opacity.coffee