@@ -12089,6 +12089,7 @@ describe('$compile', function() {
12089
12089
it ( 'should return the module' , function ( ) {
12090
12090
var myModule = angular . module ( 'my' , [ ] ) ;
12091
12091
expect ( myModule . component ( 'myComponent' , { } ) ) . toBe ( myModule ) ;
12092
+ expect ( myModule . component ( { } ) ) . toBe ( myModule ) ;
12092
12093
} ) ;
12093
12094
12094
12095
it ( 'should register a directive' , function ( ) {
@@ -12107,6 +12108,34 @@ describe('$compile', function() {
12107
12108
} ) ;
12108
12109
} ) ;
12109
12110
12111
+ it ( 'should register multiple directives when object passed as first parameter' , function ( ) {
12112
+ var log = '' ;
12113
+ angular . module ( 'my' , [ ] ) . component ( {
12114
+ fooComponent : {
12115
+ template : '<div>FOO SUCCESS</div>' ,
12116
+ controller : function ( ) {
12117
+ log += 'FOO:OK' ;
12118
+ }
12119
+ } ,
12120
+ barComponent : {
12121
+ template : '<div>BAR SUCCESS</div>' ,
12122
+ controller : function ( ) {
12123
+ log += 'BAR:OK' ;
12124
+ }
12125
+ }
12126
+ } ) ;
12127
+ module ( 'my' ) ;
12128
+
12129
+ inject ( function ( $compile , $rootScope ) {
12130
+ var fooElement = $compile ( '<foo-component></foo-component>' ) ( $rootScope ) ;
12131
+ var barElement = $compile ( '<bar-component></bar-component>' ) ( $rootScope ) ;
12132
+
12133
+ expect ( fooElement . find ( 'div' ) . text ( ) ) . toEqual ( 'FOO SUCCESS' ) ;
12134
+ expect ( barElement . find ( 'div' ) . text ( ) ) . toEqual ( 'BAR SUCCESS' ) ;
12135
+ expect ( log ) . toEqual ( 'FOO:OKBAR:OK' ) ;
12136
+ } ) ;
12137
+ } ) ;
12138
+
12110
12139
it ( 'should register a directive via $compileProvider.component()' , function ( ) {
12111
12140
module ( function ( $compileProvider ) {
12112
12141
$compileProvider . component ( 'myComponent' , {
0 commit comments