@@ -4235,6 +4235,53 @@ describe('$compile', function() {
4235
4235
} ) ;
4236
4236
4237
4237
4238
+ it ( 'should eventually expose isolate scope variables on ES6 class controller with controllerAs when bindToController is true' , function ( ) {
4239
+ if ( ! / c h r o m e / i. test ( navigator . userAgent ) ) return ;
4240
+ /*jshint -W061 */
4241
+ var controllerCalled = false ;
4242
+ module ( function ( $compileProvider ) {
4243
+ $compileProvider . directive ( 'fooDir' , valueFn ( {
4244
+ template : '<p>isolate</p>' ,
4245
+ scope : {
4246
+ 'data' : '=dirData' ,
4247
+ 'str' : '@dirStr' ,
4248
+ 'fn' : '&dirFn'
4249
+ } ,
4250
+ controller : eval (
4251
+ "class Foo {" +
4252
+ " constructor($scope) {}" +
4253
+ " check() {" +
4254
+ " expect(this.data).toEqualData({" +
4255
+ " 'foo': 'bar'," +
4256
+ " 'baz': 'biz'" +
4257
+ " });" +
4258
+ " expect(this.str).toBe('Hello, world!');" +
4259
+ " expect(this.fn()).toBe('called!');" +
4260
+ " controllerCalled = true;" +
4261
+ " }" +
4262
+ "}"
4263
+ ) ,
4264
+ controllerAs : 'test' ,
4265
+ bindToController : true
4266
+ } ) ) ;
4267
+ } ) ;
4268
+ inject ( function ( $compile , $rootScope ) {
4269
+ $rootScope . fn = valueFn ( 'called!' ) ;
4270
+ $rootScope . whom = 'world' ;
4271
+ $rootScope . remoteData = {
4272
+ 'foo' : 'bar' ,
4273
+ 'baz' : 'biz'
4274
+ } ;
4275
+ element = $compile ( '<div foo-dir dir-data="remoteData" ' +
4276
+ 'dir-str="Hello, {{whom}}!" ' +
4277
+ 'dir-fn="fn()"></div>' ) ( $rootScope ) ;
4278
+ element . data ( '$fooDirController' ) . check ( ) ;
4279
+ expect ( controllerCalled ) . toBe ( true ) ;
4280
+ } ) ;
4281
+ /*jshint +W061 */
4282
+ } ) ;
4283
+
4284
+
4238
4285
it ( 'should update @-bindings on controller when bindToController and attribute change observed' , function ( ) {
4239
4286
module ( function ( $compileProvider ) {
4240
4287
$compileProvider . directive ( 'atBinding' , valueFn ( {
0 commit comments