Skip to content

Commit b89e0f8

Browse files
committed
feat(uiView): merge autoscroll expression test.
1 parent ee26228 commit b89e0f8

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

test/viewDirectiveSpec.js

+10-12
Original file line numberDiff line numberDiff line change
@@ -223,27 +223,25 @@ describe('uiView', function () {
223223
expect($anchorScroll).not.toHaveBeenCalled();
224224
}));
225225

226-
it('should autoscroll when expr is missing', inject(function ($state, $q, $anchorScroll) {
226+
it('should autoscroll when expression is missing', inject(function ($state, $q, $anchorScroll) {
227227
elem.append($compile('<div ui-view autoscroll></div>')(scope));
228228
$state.transitionTo(gState);
229229
$q.flush();
230230
expect($anchorScroll).toHaveBeenCalled();
231231
}));
232232

233-
it('should autoscroll when expression is truthy', inject(function ($state, $q, $anchorScroll) {
234-
elem.append($compile('<div ui-view autoscroll="doAutoScroll"></div>')(scope));
235-
scope.doAutoScroll = true;
236-
$state.transitionTo(gState);
237-
$q.flush();
238-
expect($anchorScroll).toHaveBeenCalled();
239-
}));
233+
it('should autoscroll based on expression', inject(function ($state, $q, $anchorScroll) {
234+
elem.append($compile('<div ui-view autoscroll="doScroll"></div>')(scope));
240235

241-
it('should not autoscroll when expression is falsy', inject(function ($state, $q, $anchorScroll) {
242-
elem.append($compile('<div ui-view autoscroll="doAutoScroll()"></div>')(scope));
243-
scope.doAutoScroll = function () { return false; };
244-
$state.transitionTo(gState);
236+
scope.doScroll = false;
237+
$state.transitionTo(aState);
245238
$q.flush();
246239
expect($anchorScroll).not.toHaveBeenCalled();
240+
241+
scope.doScroll = true;
242+
$state.transitionTo(bState);
243+
$q.flush();
244+
expect($anchorScroll).toHaveBeenCalled();
247245
}));
248246
});
249247

0 commit comments

Comments
 (0)