Skip to content

Commit abb59b9

Browse files
committed
runtest - moved after test cleanup to try finally
1 parent 8ea3f38 commit abb59b9

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

test/BasicTestsSpec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ describe('uiScroll', function () {
161161
it('should clip 3 divs from the top and add 3 more divs to the bottom (9 divs total) (+ 2 padding divs)', function () {
162162
runTest(scrollSettings,
163163
function (viewport, scope, $timeout) {
164-
164+
// padding calculations are different now, besides the specific number of elements clipped
165+
// is not that important and a test for cliptop/bottom methods of the viewport object is more appropriate
165166
viewport.scrollTop(100);
166167
viewport.trigger('scroll');
167168
$timeout.flush();
@@ -246,6 +247,7 @@ describe('uiScroll', function () {
246247
inject(function (myMultipageDatasource) {
247248
spy = spyOn(myMultipageDatasource, 'get').and.callThrough();
248249
});
250+
249251
runTest(scrollSettings,
250252
function (viewport, scope, $timeout) {
251253
var flush = $timeout.flush;

test/scaffolding.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,27 @@ var runTest = function (scrollSettings, run, options) {
1818
inject(function ($rootScope, $compile, $window, $timeout) {
1919
var scroller = angular.element(createHtml(scrollSettings));
2020
var scope = $rootScope.$new();
21+
22+
//if (angular.element(document).find('body').find('div').children().length)
23+
//debugger
24+
2125
angular.element(document).find('body').append(scroller);
2226

2327
$compile(scroller)(scope);
2428

2529
scope.$apply();
2630
$timeout.flush();
2731

28-
run(scroller, scope, $timeout);
32+
try {
33+
run(scroller, scope, $timeout);
34+
} finally {
35+
scroller.remove();
2936

30-
scroller.remove();
31-
32-
if (options && typeof options.cleanupTest === 'function') {
33-
options.cleanupTest(scroller, scope, $timeout);
37+
if (options && typeof options.cleanupTest === 'function') {
38+
options.cleanupTest(scroller, scope, $timeout);
39+
}
3440
}
41+
3542
}
3643
);
3744
};

0 commit comments

Comments
 (0)