Commit 2cdff946 authored by Aron Carroll's avatar Aron Carroll Committed by Nick Stenning

Add unit tests to verify showHighlights option

parent ba5f3375
...@@ -50,6 +50,7 @@ module.exports = function(config) { ...@@ -50,6 +50,7 @@ module.exports = function(config) {
'h/static/scripts/plugin/heatmap.js', 'h/static/scripts/plugin/heatmap.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/static/scripts/hypothesis.js',
'h/templates/*.html', 'h/templates/*.html',
'tests/js/**/*-test.coffee' 'tests/js/**/*-test.coffee'
], ],
......
assert = chai.assert
sinon.assert.expose(assert, prefix: '')
describe 'Annotator.Host', ->
createHost = (options) ->
element = document.createElement('div')
return new Annotator.Host(element, options)
# Disable Annotator's ridiculous logging.
before -> sinon.stub(console, 'log')
after -> console.log.restore()
describe 'options', ->
it 'enables highlighting when showHighlights option is provided', (done) ->
host = createHost(showHighlights: true)
host.on 'panelReady', ->
assert.isTrue(host.visibleHighlights)
done()
host.publish('panelReady')
it 'does not enable highlighting when no showHighlights option is provided', (done) ->
host = createHost({})
host.on 'panelReady', ->
assert.isFalse(host.visibleHighlights)
done()
host.publish('panelReady')
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