Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
add a spec to make sure all the mouse events are raised
Browse files Browse the repository at this point in the history
  • Loading branch information
dnagir committed Nov 23, 2011
1 parent e29c9e2 commit 0b23d63
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions spec/javascripts/ios-checkboxes_spec.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,26 @@ describe "iOS Checkboxes", ->
check.iphoneStyle()
check.parent()

simulateSwitch = (container) ->
# This sends the up/down events to the element simulating that the button is pressed
container.trigger $.Event 'mousedown', pageX: 1
container.trigger $.Event 'mouseup', pageX: 1

it "should have jQuery extensions", ->
expect(jQuery.fn.iphoneStyle).toBeTruthy()

it "should be able to switch with mouse", ->
container = iphonify()
input = container.find ':checkbox'
initialVal = input.prop 'checked'

simulateSwitch container
expect( input.prop 'checked' ).toBe not initialVal

simulateSwitch container
expect( input.prop 'checked' ).toBe initialVal


it "should apply css classes to the on/off button", ->
wrap = iphonify()
expect(wrap).toBe ".iPhoneCheckContainer"
Expand Down

0 comments on commit 0b23d63

Please sign in to comment.