Commit 30704ff9 authored by Aron Carroll's avatar Aron Carroll

Add tests for onAdderMouseup handler

parent e0ddcd32
...@@ -46,6 +46,7 @@ module.exports = function(config) { ...@@ -46,6 +46,7 @@ module.exports = function(config) {
'h/static/scripts/auth.js', 'h/static/scripts/auth.js',
'h/static/scripts/helpers.js', 'h/static/scripts/helpers.js',
'h/static/scripts/session.js', 'h/static/scripts/session.js',
'h/static/scripts/hypothesis.js',
'h/static/scripts/vendor/sinon.js', 'h/static/scripts/vendor/sinon.js',
'h/static/scripts/vendor/chai.js', 'h/static/scripts/vendor/chai.js',
'h/templates/*.html', 'h/templates/*.html',
......
assert = chai.assert
sinon.assert.expose(assert, prefix: '')
describe 'Annotator.Guest', ->
createGuest = (options) ->
element = document.createElement('div')
return new Annotator.Guest(element, options || {})
# Silence Annotator's sassy backchat
before -> sinon.stub(console, 'log')
after -> console.log.restore()
describe 'onAdderMouseUp', ->
it 'it prevents the default browser action when triggered', () ->
event = jQuery.Event('mouseup')
guest = createGuest()
guest.onAdderMouseup(event)
assert.isTrue(event.isDefaultPrevented())
it 'it stops any further event bubbling', () ->
event = jQuery.Event('mouseup')
guest = createGuest()
guest.onAdderMouseup(event)
assert.isTrue(event.isPropagationStopped())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment