@@ -85,7 +85,7 @@ describe('uiCalendar', function () {
85
85
it ( 'sets names for $locale by default' , function ( ) {
86
86
spyOn ( $ . fn , 'fullCalendar' ) ;
87
87
$locale . DATETIME_FORMATS . MONTH [ 0 ] = 'enero' ;
88
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
88
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
89
89
scope . $apply ( ) ;
90
90
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . monthNames [ 0 ] ) . toBe ( 'enero' ) ;
91
91
} ) ;
@@ -94,58 +94,58 @@ describe('uiCalendar', function () {
94
94
spyOn ( $ . fn , 'fullCalendar' ) ;
95
95
scope . uiConfig . calendar . monthNames = $locale . DATETIME_FORMATS . MONTH . slice ( ) ;
96
96
scope . uiConfig . calendar . monthNames [ 0 ] = 'custom name' ;
97
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
97
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
98
98
scope . $apply ( ) ;
99
99
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . monthNames [ 0 ] ) . toBe ( 'custom name' ) ;
100
100
} ) ;
101
101
102
102
/* test the calendar's events length */
103
103
it ( 'expects to load 4 events to scope' , function ( ) {
104
104
spyOn ( $ . fn , 'fullCalendar' ) ;
105
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
105
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
106
106
scope . $apply ( ) ;
107
107
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ) . toBe ( 4 ) ;
108
108
} ) ;
109
109
/* test to check the title of the first event. */
110
110
it ( 'expects to be All Day Event' , function ( ) {
111
111
spyOn ( $ . fn , 'fullCalendar' ) ;
112
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
112
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
113
113
scope . $apply ( ) ;
114
114
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] [ 0 ] . title ) . toBe ( 'All Day Event' ) ;
115
115
} ) ;
116
116
/* test to make sure the event has a url assigned to it. */
117
117
it ( 'expects the url to = http://www.angularjs.org' , function ( ) {
118
118
spyOn ( $ . fn , 'fullCalendar' ) ;
119
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
119
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
120
120
scope . $apply ( ) ;
121
121
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] [ 0 ] . url ) . toBe ( 'http://www.angularjs.org' ) ;
122
122
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 1 ] [ 0 ] . url ) . toBe ( 'http://www.atlantacarlocksmith.com' ) ;
123
123
} ) ;
124
124
/* test the 3rd events' allDay field. */
125
125
it ( 'expects the fourth Events all Day field to equal true' , function ( ) {
126
126
spyOn ( $ . fn , 'fullCalendar' ) ;
127
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
127
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
128
128
scope . $apply ( ) ;
129
129
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] [ 3 ] . allDay ) . toNotBe ( false ) ;
130
130
} ) ;
131
131
/* Tests the height of the calendar. */
132
132
it ( 'expects the calendar attribute height to be 200' , function ( ) {
133
133
spyOn ( $ . fn , 'fullCalendar' ) ;
134
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
134
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
135
135
scope . $apply ( ) ;
136
136
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . height ) . toEqual ( 200 ) ;
137
137
} ) ;
138
138
/* Tests the weekends boolean of the calendar. */
139
139
it ( 'expects the calendar attribute weekends to be false' , function ( ) {
140
140
spyOn ( $ . fn , 'fullCalendar' ) ;
141
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
141
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
142
142
scope . $apply ( ) ;
143
143
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . weekends ) . toEqual ( false ) ;
144
144
} ) ;
145
145
/* Test to make sure that when an event is added to the calendar everything is updated with the new event. */
146
146
it ( 'expects the scopes events to increase by 2' , function ( ) {
147
147
spyOn ( $ . fn , 'fullCalendar' ) ;
148
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
148
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
149
149
scope . $apply ( ) ;
150
150
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ) . toEqual ( 4 ) ;
151
151
scope . addChild ( scope . events ) ;
@@ -155,7 +155,7 @@ describe('uiCalendar', function () {
155
155
/* Test to make sure the calendar is updating itself on changes to events length. */
156
156
it ( 'expects the calendar to update itself with new events' , function ( ) {
157
157
spyOn ( $ . fn , 'fullCalendar' ) ;
158
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
158
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
159
159
scope . $apply ( ) ;
160
160
var clientEventsLength = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ;
161
161
expect ( clientEventsLength ) . toEqual ( 4 ) ;
@@ -173,7 +173,7 @@ describe('uiCalendar', function () {
173
173
header : { center : 'title' }
174
174
}
175
175
} ;
176
- $compile ( '<div ui-calendar="uiConfig2.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
176
+ $compile ( '<div ui-calendar="uiConfig2.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
177
177
scope . $apply ( ) ;
178
178
expect ( $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . hasOwnProperty ( 'header' ) ) . toEqual ( true ) ;
179
179
var header = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . header ;
@@ -182,7 +182,7 @@ describe('uiCalendar', function () {
182
182
/* Test to see if calendar is watching all eventSources for changes. */
183
183
it ( 'updates the calendar if any eventSource array contains a delta' , function ( ) {
184
184
spyOn ( $ . fn , 'fullCalendar' ) ;
185
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
185
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
186
186
scope . $apply ( ) ;
187
187
var clientEventsLength = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ;
188
188
var clientEventsLength2 = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 1 ] . length ;
@@ -202,7 +202,7 @@ describe('uiCalendar', function () {
202
202
/* Test to see if calendar is updating when a new eventSource is added. */
203
203
it ( 'updates the calendar if an eventSource is Added' , function ( ) {
204
204
spyOn ( $ . fn , 'fullCalendar' ) ;
205
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
205
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
206
206
scope . $apply ( ) ;
207
207
var clientEventSources = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources . length ;
208
208
expect ( clientEventSources ) . toEqual ( 2 ) ;
@@ -219,7 +219,7 @@ describe('uiCalendar', function () {
219
219
/* Test to see if calendar is updating when an eventSource replaces another with an equal length. */
220
220
it ( 'updates the calendar if an eventSource has same length as prior eventSource' , function ( ) {
221
221
spyOn ( $ . fn , 'fullCalendar' ) ;
222
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
222
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
223
223
scope . $apply ( ) ;
224
224
var clientEventSources = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources ;
225
225
var clientEventsLength = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ;
@@ -240,7 +240,7 @@ describe('uiCalendar', function () {
240
240
241
241
it ( 'make sure the calendar can work with extended event sources' , function ( ) {
242
242
spyOn ( $ . fn , 'fullCalendar' ) ;
243
- $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
243
+ $compile ( '<div ui-calendar="uiConfig.calendar" ng-model="eventSources"></div>' ) ( scope ) ;
244
244
scope . $apply ( ) ;
245
245
var clientEventSources = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources ;
246
246
var clientEventsLength = $ . fn . fullCalendar . mostRecentCall . args [ 0 ] . eventSources [ 0 ] . length ;
@@ -250,6 +250,13 @@ describe('uiCalendar', function () {
250
250
expect ( clientEventSources [ 2 ] . events [ 0 ] . title ) . toEqual ( 'Lunch' ) ;
251
251
} ) ;
252
252
253
+ it ( 'make sure the calendar sets the myCalendar object to defining scope' , function ( ) {
254
+ expect ( scope . myCalendar ) . toBe ( undefined ) ;
255
+ $compile ( '<div ui-calendar="uiConfig.calendar" calendar="myCalendar" ng-model="eventSources"></div>' ) ( scope ) ;
256
+ scope . $apply ( ) ;
257
+ expect ( scope . myCalendar ) . not . toBe ( undefined ) ;
258
+ } ) ;
259
+
253
260
} ) ;
254
261
255
262
describe ( 'calendarCtrl' , function ( ) {
0 commit comments