1
1
describe " directives.api.Window" , ->
2
2
beforeEach ->
3
- window .google
4
- module " google-maps" .ns ()
5
- module " google-maps.mocks"
6
- inject (GoogleApiMock ) =>
7
- @gmap = new GoogleApiMock ()
8
- # @gmap.mockAPI()
9
-
3
+ window [" Initiator" .ns ()].initMock ()
10
4
@mocks =
11
5
scope :
12
6
coords :
@@ -22,18 +16,10 @@ describe "directives.api.Window", ->
22
16
attrs : {
23
17
isiconvisibleonclick : true
24
18
}
25
- ctrls : [
26
- {
27
- getMap : ()->
28
- {}
29
- }
30
- ]
31
-
32
-
33
- @ timeOutNoW = (fnc ,time ) =>
34
- fnc ()
35
- # @gMarker = new google.maps.Marker(@commonOpts)
36
- inject [' $rootScope' ,' $q' , ' $compile' , ' $http' , ' $templateCache' , ' ExtendGWin' .ns (), ' Window' .ns (),
19
+ ctrls : [{getMap : ()-> {}}]
20
+ @gmap = {}
21
+ inject [' $rootScope' ,' $q' , ' $compile' , ' $http' ,
22
+ ' $templateCache' , ' ExtendGWin' .ns (), ' Window' .ns (),
37
23
(_$rootScope_ ,$q , $compile , $http , $templateCache , ExtendGWin , Window ) =>
38
24
ExtendGWin .init ()
39
25
@$rootScope = _$rootScope_
@@ -45,8 +31,7 @@ describe "directives.api.Window", ->
45
31
@$rootScope
46
32
@windowScope = _ .extend @$rootScope .$new (), @mocks .scope
47
33
48
-
49
- @subject = new Window (@timeOutNoW ,$compile, $http, $templateCache)
34
+ @subject = new Window ()
50
35
@subject .onChildCreation = (child ) =>
51
36
@childWindow = child
52
37
@@ -70,7 +55,6 @@ describe "directives.api.Window", ->
70
55
crap = null
71
56
@prom .then ->
72
57
crap = " set"
73
- # holy crap $rootScope.$apply() must come after all promises!!!!!
74
58
@$rootScope .$apply () # force $q to resolve
75
59
expect (crap).toBe ' set'
76
60
expect (@childWindow ).toBeDefined ()
@@ -87,4 +71,4 @@ describe "directives.api.Window", ->
87
71
@$rootScope .$apply () # force $q to resolve
88
72
expect (@mocks .scope .control .getChildWindows ().length ).toBe (1 )
89
73
expect (@mocks .scope .control .getChildWindows ()[0 ]).toEqual (@childWindow )
90
- expect (@mocks .scope .control .getGWindows ()[0 ]).toEqual (@childWindow .gWin )
74
+ expect (@mocks .scope .control .getGWindows ()[0 ]).toEqual (@childWindow .gWin )
0 commit comments