Commit a9eabbff authored by Aron Carroll's avatar Aron Carroll

Add tests for setting ThreadController.isRoot

parent 848d0694
...@@ -99,7 +99,9 @@ describe 'h.directives.thread.ThreadController', -> ...@@ -99,7 +99,9 @@ describe 'h.directives.thread.ThreadController', ->
describe 'h.directives.thread.thread', -> describe 'h.directives.thread.thread', ->
createElement = null
$element = null $element = null
$isolateScope = null
fakePulse = null fakePulse = null
sandbox = null sandbox = null
...@@ -112,12 +114,22 @@ describe 'h.directives.thread.thread', -> ...@@ -112,12 +114,22 @@ describe 'h.directives.thread.thread', ->
return return
beforeEach inject ($compile, $rootScope) -> beforeEach inject ($compile, $rootScope) ->
$element = $compile('<div thread></div>')($rootScope.$new()) createElement = (html) -> $compile(html or '<div thread></div>')($rootScope.$new())
$element = createElement()
$isolateScope = $element.scope() $isolateScope = $element.scope()
afterEach -> afterEach ->
sandbox.restore() sandbox.restore()
it 'sets the threadRoot on the controller to false', ->
controller = $element.controller('thread')
assert.isFalse(controller.isRoot)
it 'sets the threadRoot on the controller to true when the thread-root attr is set', ->
$element = createElement('<div thread thread-root="true"></div>')
controller = $element.controller('thread')
assert.isTrue(controller.isRoot)
it 'pulses the current thread on an annotationUpdated event', -> it 'pulses the current thread on an annotationUpdated event', ->
$element.scope().$emit('annotationUpdate') $element.scope().$emit('annotationUpdate')
assert.called(fakePulse) assert.called(fakePulse)
......
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