mkousta / hasEvent

JavaScript test support utility

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hasEvent

JavaScript test support utility for jQuery events

Build Status

A way to detect the presence of jQuery events is currently a wontfix, thus this helper.

Installation

bower install hasEvent

Don't forget to include the lib itself, located in dist/has_event.js

Usage

The examples below use chai should style assertions.

  // Native event
  $('.foo').hasEvent('click', someHandler).should.be.true

  // Custom event
  $('.foo').hasEvent('custom', someHandler).should.be.true

  // Delegated event
  $('body').hasEvent('click', '.foo .bar', somehandler).should.be.true

  // 'Live' event
  $(document).hasEvent('click', '.foo .bar', someHandler).should.be.true

  // Event on window
  $(window).hasEvent('scroll', someHandler).should.be.false

Tests

Currently there are tests against jQuery versions 1.7 up to 2.0.3

Browse the builds here

Author

Dimitris Zorbas (@zorbash)

Licence

Copyright (c) 2013 Dimitris Zorbash Licensed under the MIT license.

About

JavaScript test support utility

License:MIT License


Languages

Language:JavaScript 94.3%Language:CoffeeScript 4.1%Language:CSS 1.6%