Skip to content

Commit

Permalink
fix(uiView): autoscroll tests pass on 1.2.4 & 1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Dec 28, 2013
1 parent 83b6634 commit 86eacac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ module.exports = function (grunt) {
browsers: [ grunt.option('browser') || 'Chrome' ]
},
past: {
configFile: 'config/karma-1.0.8.js',
configFile: 'config/karma-1.0.8.js'
},
unstable: {
configFile: 'config/karma-1.1.5.js',
configFile: 'config/karma-1.1.5.js'
}
},
changelog: {
Expand Down
17 changes: 12 additions & 5 deletions test/viewDirectiveSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,18 +271,20 @@ describe('uiView', function () {
});

describe('autoscroll attribute', function () {
it('should autoscroll when unspecified', inject(function ($state, $q, $uiViewScroll) {
it('should autoscroll when unspecified', inject(function ($state, $q, $uiViewScroll, $animate) {
elem.append($compile('<div><ui-view></ui-view></div>')(scope));
$state.transitionTo(aState);
$q.flush();
expect($uiViewScroll).toHaveBeenCalledWith(elem.find('ui-view'));
if ($animate) $animate.flush();
expect($uiViewScroll).toHaveBeenCalledWith(elem.find('span').parent());
}));

it('should autoscroll when expression is missing', inject(function ($state, $q, $uiViewScroll) {
it('should autoscroll when expression is missing', inject(function ($state, $q, $uiViewScroll, $animate) {
elem.append($compile('<div><ui-view autoscroll></ui-view></div>')(scope));
$state.transitionTo(aState);
$q.flush();
expect($uiViewScroll).toHaveBeenCalledWith(elem.find('ui-view'));
if ($animate) $animate.flush();
expect($uiViewScroll).toHaveBeenCalledWith(elem.find('span').parent());
}));

it('should autoscroll based on expression', inject(function ($state, $q, $uiViewScroll, $animate) {
Expand All @@ -298,7 +300,12 @@ describe('uiView', function () {
$q.flush();
if ($animate) $animate.flush();

expect($uiViewScroll).toHaveBeenCalledWith(elem.find('ui-view'));
var target;
angular.forEach(elem.find('ui-view'), function(view) {
if (angular.element(view).text() === bState.template) target = angular.element(view);
});

expect($uiViewScroll).toHaveBeenCalledWith(target);
}));
});

Expand Down

0 comments on commit 86eacac

Please sign in to comment.