@@ -392,6 +392,7 @@ main() {
392
392
beforeEach (module ((AngularModule module) {
393
393
module.directive (SimpleComponent );
394
394
module.directive (IoComponent );
395
+ module.directive (PublishMeComponent );
395
396
}));
396
397
397
398
it ('should create a simple component' , inject (() {
@@ -422,10 +423,19 @@ main() {
422
423
expect ($rootScope.done).toEqual (true );
423
424
}));
424
425
425
- it ('should allow the component to publish itself into the scope' , inject (() {
426
-
426
+ it ('should throw an exception if required directive is missing' , inject ((Compiler $compile, Scope $rootScope, Injector injector) {
427
+ expect (() {
428
+ var element = $('<tab local><pane></pane><pane local></pane></tab>' );
429
+ $compile (element)(injector, element);
430
+ }, throwsA (contains ('No provider found for LocalAttrDirective! (resolving LocalAttrDirective)' )));
427
431
}));
428
432
433
+ iit ('should publish component controller into the scope' , inject (() {
434
+ var element = $(r'<div><publish-me></publish-me></div>' );
435
+ $compile (element)(injector, element);
436
+ $rootScope.$apply ();
437
+ expect (element.textWithShadow ()).toEqual ('WORKED' );
438
+ }));
429
439
});
430
440
431
441
describe ('controller scoping' , () {
@@ -443,13 +453,6 @@ main() {
443
453
expect (log.result ()).toEqual ('IncludeTransclude; SimpleTransclude' );
444
454
}));
445
455
446
- it ('should throw an exception if required directive is missing' , inject ((Compiler $compile, Scope $rootScope, Injector injector) {
447
- expect (() {
448
- var element = $('<tab local><pane></pane><pane local></pane></tab>' );
449
- $compile (element)(injector, element);
450
- }, throwsA (contains ('No provider found for LocalAttrDirective! (resolving LocalAttrDirective)' )));
451
- }));
452
-
453
456
});
454
457
});
455
458
}
@@ -470,3 +473,11 @@ class IoComponent {
470
473
scope.$root.ioComponent = this ;
471
474
}
472
475
}
476
+
477
+ class PublishMeComponent {
478
+ static String $template = r'<content>{{ctrlName.value}}</content>' ;
479
+ static String $publishAs = 'ctrlName' ;
480
+
481
+ String value = 'WORKED' ;
482
+ PublishMeComponent () {}
483
+ }
0 commit comments