Skip to content

Commit 39f76cb

Browse files
test(Resolve): Test that $resolve is on $scope when view has no controller
Closes #2626
1 parent 3a1308b commit 39f76cb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

test/viewDirectiveSpec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,17 @@ describe('uiView', function () {
363363
expect(_scope.$resolve.user).toBe('joeschmoe')
364364
}));
365365

366+
it('should provide the resolved data on the $scope even if there is no controller', inject(function ($state, $q, $timeout) {
367+
var state = angular.extend({}, _state, { template: '{{$resolve.user}}' });
368+
$stateProvider.state(state);
369+
elem.append($compile('<div><ui-view></ui-view></div>')(scope));
370+
expect(elem.text()).toBe('');
371+
372+
$state.transitionTo('resolve'); $q.flush(); $timeout.flush();
373+
expect(elem.text()).toBe('joeschmoe');
374+
expect(scope.$resolve).toBeDefined();
375+
}));
376+
366377
it('should put the resolved data on the resolveAs variable', inject(function ($state, $q, $timeout) {
367378
var state = angular.extend({}, _state, { template: '{{$$$resolve.user}}', resolveAs: '$$$resolve', controller: controller });
368379
$stateProvider.state(state);

0 commit comments

Comments
 (0)