Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit feb8a86

Browse files
committed
chore(tests): bump to 1.4.3
1 parent 7bf3a2b commit feb8a86

File tree

4 files changed

+28
-30
lines changed

4 files changed

+28
-30
lines changed

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"url": "https://github.com/angular-ui/bootstrap.git"
1010
},
1111
"devDependencies": {
12-
"angular": "<=1.3.x",
13-
"angular-mocks": "<=1.3.x",
12+
"angular": "^1.4.3",
13+
"angular-mocks": "^1.4.3",
1414
"grunt": "^0.4.5",
1515
"grunt-contrib-concat": "^0.5.1",
1616
"grunt-contrib-copy": "^0.8.0",

Diff for: src/collapse/test/collapse.spec.js

-8
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ describe('collapse directive', function () {
2323
it('should be hidden on initialization if isCollapsed = true without transition', function() {
2424
scope.isCollapsed = true;
2525
scope.$digest();
26-
$animate.triggerCallbacks();
27-
//No animation timeout here
2826
expect(element.height()).toBe(0);
2927
});
3028

@@ -33,14 +31,12 @@ describe('collapse directive', function () {
3331
scope.$digest();
3432
scope.isCollapsed = true;
3533
scope.$digest();
36-
$animate.triggerCallbacks();
3734
expect(element.height()).toBe(0);
3835
});
3936

4037
it('should be shown on initialization if isCollapsed = false without transition', function() {
4138
scope.isCollapsed = false;
4239
scope.$digest();
43-
//No animation timeout here
4440
expect(element.height()).not.toBe(0);
4541
});
4642

@@ -51,7 +47,6 @@ describe('collapse directive', function () {
5147
scope.$digest();
5248
scope.isCollapsed = false;
5349
scope.$digest();
54-
$animate.triggerCallbacks();
5550
expect(element.height()).not.toBe(0);
5651
});
5752

@@ -64,9 +59,6 @@ describe('collapse directive', function () {
6459
scope.$digest();
6560
scope.isCollapsed = true;
6661
scope.$digest();
67-
$animate.triggerCallbacks();
68-
expect(element.height()).toBe(0);
69-
$animate.triggerCallbacks();
7062
expect(element.height()).toBe(0);
7163
});
7264

Diff for: src/dropdown/test/dropdown.spec.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
describe('dropdownToggle', function() {
2-
var $compile, $rootScope, $document, $templateCache, dropdownConfig, element, $browser;
2+
var $animate, $compile, $rootScope, $document, $templateCache, dropdownConfig, element, $browser;
33

4+
beforeEach(module('ngAnimateMock'));
45
beforeEach(module('ui.bootstrap.dropdown'));
56

6-
beforeEach(inject(function(_$compile_, _$rootScope_, _$document_, _$templateCache_, _dropdownConfig_, _$browser_) {
7+
beforeEach(inject(function(_$animate_, _$compile_, _$rootScope_, _$document_, _$templateCache_, _dropdownConfig_, _$browser_) {
8+
$animate = _$animate_;
79
$compile = _$compile_;
810
$rootScope = _$rootScope_;
911
$document = _$document_;
@@ -184,7 +186,7 @@ describe('dropdownToggle', function() {
184186
expect(element.hasClass(dropdownConfig.openClass)).toBe(false);
185187
});
186188
});
187-
189+
188190
describe('using dropdownMenuTemplate', function() {
189191
function dropdown() {
190192
$templateCache.put('custom.html', '<ul class="dropdown-menu"><li>Item 1</li></ul>');
@@ -195,7 +197,7 @@ describe('dropdownToggle', function() {
195197
beforeEach(function() {
196198
element = dropdown();
197199
});
198-
200+
199201
it('should apply custom template for dropdown menu', function() {
200202
element.find('a').click();
201203
expect(element.find('ul.dropdown-menu').eq(0).find('li').eq(0).text()).toEqual('Item 1');
@@ -323,11 +325,11 @@ describe('dropdownToggle', function() {
323325
it('should call it correctly when toggles', function() {
324326
$rootScope.isopen = true;
325327
$rootScope.$digest();
326-
$browser.defer.flush();
328+
$animate.triggerCallbacks();
327329
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);
328330

329331
clickDropdownToggle();
330-
$browser.defer.flush();
332+
$animate.triggerCallbacks();
331333
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);
332334
});
333335
});
@@ -341,19 +343,19 @@ describe('dropdownToggle', function() {
341343
});
342344

343345
it('should not have been called initially', function() {
344-
$browser.defer.flush();
346+
$animate.triggerCallbacks();
345347
expect($rootScope.toggleHandler).not.toHaveBeenCalled();
346348
});
347349

348350
it('should call it correctly when toggles', function() {
349351
$rootScope.isopen = false;
350352
$rootScope.$digest();
351-
$browser.defer.flush();
353+
$animate.triggerCallbacks();
352354
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);
353355

354356
$rootScope.isopen = true;
355357
$rootScope.$digest();
356-
$browser.defer.flush();
358+
$animate.triggerCallbacks();
357359
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);
358360
});
359361
});
@@ -366,17 +368,17 @@ describe('dropdownToggle', function() {
366368
});
367369

368370
it('should not have been called initially', function() {
369-
$browser.defer.flush();
371+
$animate.triggerCallbacks();
370372
expect($rootScope.toggleHandler).not.toHaveBeenCalled();
371373
});
372374

373375
it('should call it when clicked', function() {
374376
clickDropdownToggle();
375-
$browser.defer.flush();
377+
$animate.triggerCallbacks();
376378
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);
377379

378380
clickDropdownToggle();
379-
$browser.defer.flush();
381+
$animate.triggerCallbacks();
380382
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);
381383
});
382384
});

Diff for: src/modal/test/modal.spec.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe('$modal', function () {
2-
var $controllerProvider, $rootScope, $document, $compile, $templateCache, $timeout, $q;
2+
var $animate, $controllerProvider, $rootScope, $document, $compile, $templateCache, $timeout, $q;
33
var $modal, $modalProvider;
44

55
var triggerKeyDown = function (element, keyCode) {
@@ -8,6 +8,7 @@ describe('$modal', function () {
88
element.trigger(e);
99
};
1010

11+
beforeEach(module('ngAnimateMock'));
1112
beforeEach(module('ui.bootstrap.modal'));
1213
beforeEach(module('template/modal/backdrop.html'));
1314
beforeEach(module('template/modal/window.html'));
@@ -16,7 +17,8 @@ describe('$modal', function () {
1617
$modalProvider = _$modalProvider_;
1718
}));
1819

19-
beforeEach(inject(function (_$rootScope_, _$document_, _$compile_, _$templateCache_, _$timeout_, _$q_, _$modal_) {
20+
beforeEach(inject(function (_$animate_, _$rootScope_, _$document_, _$compile_, _$templateCache_, _$timeout_, _$q_, _$modal_) {
21+
$animate = _$animate_;
2022
$rootScope = _$rootScope_;
2123
$document = _$document_;
2224
$compile = _$compile_;
@@ -150,7 +152,7 @@ describe('$modal', function () {
150152
var closed = modal.close(result);
151153
$rootScope.$digest();
152154
if (!noFlush) {
153-
$timeout.flush();
155+
$animate.triggerCallbacks();
154156
}
155157
return closed;
156158
}
@@ -159,7 +161,7 @@ describe('$modal', function () {
159161
var closed = modal.dismiss(reason);
160162
$rootScope.$digest();
161163
if (!noFlush) {
162-
$timeout.flush();
164+
$animate.triggerCallbacks();
163165
}
164166
return closed;
165167
}
@@ -175,6 +177,7 @@ describe('$modal', function () {
175177
expect($document).toHaveBackdrop();
176178

177179
dismiss(modal, 'closing in test');
180+
$animate.triggerCallbacks();
178181

179182
expect($document).toHaveModalsOpen(0);
180183

@@ -221,6 +224,7 @@ describe('$modal', function () {
221224
expect($document).toHaveBackdrop();
222225

223226
dismiss(modal, 'closing in test');
227+
$animate.triggerCallbacks();
224228

225229
expect($document).toHaveModalsOpen(0);
226230

@@ -233,7 +237,7 @@ describe('$modal', function () {
233237
expect($document).toHaveModalsOpen(1);
234238

235239
triggerKeyDown($document, 27);
236-
$timeout.flush();
240+
$animate.triggerCallbacks();
237241
$rootScope.$digest();
238242

239243
expect($document).toHaveModalsOpen(0);
@@ -245,7 +249,7 @@ describe('$modal', function () {
245249
expect($document).toHaveModalsOpen(1);
246250

247251
$document.find('body > div.modal').click();
248-
$timeout.flush();
252+
$animate.triggerCallbacks();
249253
$rootScope.$digest();
250254

251255
expect($document).toHaveModalsOpen(0);
@@ -263,7 +267,7 @@ describe('$modal', function () {
263267
expect($document).toHaveModalsOpen(1);
264268

265269
triggerKeyDown($document, 27);
266-
$timeout.flush();
270+
$animate.triggerCallbacks();
267271
$rootScope.$digest();
268272

269273
expect(document.activeElement.tagName).toBe('A');
@@ -287,7 +291,7 @@ describe('$modal', function () {
287291
// iframe conditions. See issue 3639
288292
element[0].focus = undefined;
289293
triggerKeyDown($document, 27);
290-
$timeout.flush();
294+
$animate.triggerCallbacks();
291295
$rootScope.$digest();
292296

293297
expect(document.activeElement.tagName).toBe('BODY');

0 commit comments

Comments
 (0)