-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
main.module.spec.coffee
31 lines (25 loc) · 1.05 KB
/
main.module.spec.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
beforeEach ->
module 'waterfall_view'
describe 'Waterfall view controller', ->
createController = scope = $rootScope = $state = elem = $document = null
injected = ($injector) ->
$rootScope = $injector.get('$rootScope')
scope = $rootScope.$new()
$compile = $injector.get('$compile')
$controller = $injector.get('$controller')
$state = $injector.get('$state')
$document = $injector.get('$document')
elem = angular.element('<div></div>')
$document.find("body").append(elem)
elem.append($compile('<ui-view></ui-view>')(scope))
beforeEach(inject(injected))
# make sure we remove the element from the dom
afterEach ->
elem.remove()
expect($document.find("svg").length).toEqual(0)
it 'should be defined', ->
$state.transitionTo('waterfall')
$rootScope.$digest()
# make sure the whole stuff created lots of graphics data
expect(elem.find("svg").length).toBeGreaterThan(1)
expect(elem.find("g").length).toBeGreaterThan(10)