@@ -9,8 +9,8 @@ describe("angular", () => {
99
1010 beforeEach ( ( ) => {
1111 angular = new Angular ( ) ;
12- module = angular . module ( "defaultModule " , [ "ng" ] ) ;
13- injector = createInjector ( [ "ng" , "defaultModule " ] ) ;
12+ module = angular . module ( "default " , [ "ng" ] ) ;
13+ injector = createInjector ( [ "ng" , "default " ] ) ;
1414 $rootScope = injector . get ( "$rootScope" ) ;
1515 $compile = injector . get ( "$compile" ) ;
1616 } ) ;
@@ -215,8 +215,8 @@ describe("angular", () => {
215215
216216 beforeEach ( ( ) => {
217217 angular = new Angular ( ) ;
218- module = angular . module ( "defaultModule " , [ "ng" ] ) ;
219- injector = createInjector ( [ "defaultModule " ] ) ;
218+ module = angular . module ( "default " , [ "ng" ] ) ;
219+ injector = createInjector ( [ "default " ] ) ;
220220 $rootScope = injector . get ( "$rootScope" ) ;
221221 $compile = injector . get ( "$compile" ) ;
222222 } ) ;
@@ -246,8 +246,13 @@ describe("angular", () => {
246246
247247 beforeEach ( ( ) => {
248248 angular = new Angular ( ) ;
249- module = angular . module ( "defaultModule" , [ "ng" ] ) ;
250- injector = createInjector ( [ "defaultModule" ] ) ;
249+ module = angular . module ( "default" , [ "ng" ] ) . controller (
250+ "demo" ,
251+ class Demo {
252+ static $scopename = "demo" ;
253+ } ,
254+ ) ;
255+ injector = createInjector ( [ "default" ] ) ;
251256 } ) ;
252257
253258 it ( "should return named scope" , ( ) => {
@@ -264,6 +269,22 @@ describe("angular", () => {
264269
265270 expect ( angular . getScopeByName ( "fail" ) ) . toBeUndefined ( ) ;
266271 } ) ;
272+
273+ it ( "should return controllers with static $scopename property" , ( ) => {
274+ const element = createElementFromHTML ( "<div ng-controller='demo'></div>" ) ;
275+ angular . bootstrap ( element , [ "default" ] ) ;
276+
277+ expect ( angular . getScopeByName ( "demo" ) ) . toBeDefined ( ) ;
278+ } ) ;
279+
280+ it ( "should return controllers with static $scopename property registered with `as` syntax" , ( ) => {
281+ const element = createElementFromHTML (
282+ "<div ng-controller='demo as $ctrl'></div>" ,
283+ ) ;
284+ angular . bootstrap ( element , [ "default" ] ) ;
285+
286+ expect ( angular . getScopeByName ( "demo" ) ) . toBeDefined ( ) ;
287+ } ) ;
267288 } ) ;
268289} ) ;
269290
0 commit comments