@@ -157,7 +157,7 @@ void main() {
157
157
});
158
158
159
159
it ('should compile two directives with the same selector' , (Logger log) {
160
- var element = $( _.compile ('<div two-directives></div>' ) );
160
+ var element = _.compile ('<div two-directives></div>' );
161
161
162
162
_.rootScope.apply ();
163
163
@@ -166,7 +166,7 @@ void main() {
166
166
167
167
it ('should compile a directive that ignores children' , (Logger log) {
168
168
// The ng-repeat comes first, so it is not ignored, but the children *are*
169
- var element = $( _.compile ('<div ng-repeat="i in [1,2]" ignore-children><div two-directives></div></div>' ) );
169
+ var element = _.compile ('<div ng-repeat="i in [1,2]" ignore-children><div two-directives></div></div>' );
170
170
171
171
_.rootScope.apply ();
172
172
@@ -279,7 +279,7 @@ void main() {
279
279
}));
280
280
281
281
it ('should create a component with I/O' , async (() {
282
- var element = $( _.compile (r'<div><io attr="A" expr="name" ondone="done=true"></io></div>' ) );
282
+ _.compile (r'<div><io attr="A" expr="name" ondone="done=true"></io></div>' );
283
283
microLeap ();
284
284
285
285
_.rootScope.context['name' ] = 'misko' ;
@@ -297,7 +297,7 @@ void main() {
297
297
}));
298
298
299
299
xit ('should should not create any watchers if no attributes are specified' , async ((Profiler perf) {
300
- var element = $( _.compile (r'<div><io></io></div>' ) );
300
+ _.compile (r'<div><io></io></div>' );
301
301
microLeap ();
302
302
_.injector.get (Scope ).apply ();
303
303
// Re-enable once we can publish these numbers
@@ -311,7 +311,7 @@ void main() {
311
311
312
312
it ('should create a component with I/O and "=" binding value should be available' , async (() {
313
313
_.rootScope.context['name' ] = 'misko' ;
314
- var element = $( _.compile (r'<div><io attr="A" expr="name" ondone="done=true"></io></div>' ) );
314
+ _.compile (r'<div><io attr="A" expr="name" ondone="done=true"></io></div>' );
315
315
microLeap ();
316
316
317
317
var component = _.rootScope.context['ioComponent' ];
@@ -324,8 +324,7 @@ void main() {
324
324
325
325
it ('should create a component with I/O bound to controller and "=" binding value should be available' , async (() {
326
326
_.rootScope.context['done' ] = false ;
327
- var element = $(_.compile (r'<div><io-controller attr="A" expr="name" once="name" ondone="done=true"></io-controller></div>' ));
328
-
327
+ _.compile (r'<div><io-controller attr="A" expr="name" once="name" ondone="done=true"></io-controller></div>' );
329
328
330
329
expect (_.injector).toBeDefined ();
331
330
microLeap ();
@@ -360,7 +359,7 @@ void main() {
360
359
}));
361
360
362
361
it ('should create a map attribute to controller' , async (() {
363
- var element = $( _.compile (r'<div><io-controller attr="{{name}}"></io-controller></div>' ) );
362
+ _.compile (r'<div><io-controller attr="{{name}}"></io-controller></div>' );
364
363
microLeap ();
365
364
366
365
IoControllerComponent component = _.rootScope.context['ioComponent' ];
@@ -377,7 +376,7 @@ void main() {
377
376
it ('should create a unpublished component with I/O bound to controller and "=" binding value should be available' , async (() {
378
377
_.rootScope.context['name' ] = 'misko' ;
379
378
_.rootScope.context['done' ] = false ;
380
- var element = $( _.compile (r'<div><unpublished-io-controller attr="A" expr="name" ondone="done=true"></unpublished-io-controller></div>' ) );
379
+ _.compile (r'<div><unpublished-io-controller attr="A" expr="name" ondone="done=true"></unpublished-io-controller></div>' );
381
380
microLeap ();
382
381
383
382
UnpublishedIoControllerComponent component = _.rootScope.context['ioComponent' ];
@@ -398,12 +397,12 @@ void main() {
398
397
399
398
it ('should error on incorrect mapping' , async (() {
400
399
expect (() {
401
- var element = $( _.compile (r'<div><incorrect-mapping></incorrect-mapping</div>' ) );
400
+ _.compile (r'<div><incorrect-mapping></incorrect-mapping</div>' );
402
401
}).toThrow ("Unknown mapping 'foo\' for attribute 'attr'." );
403
402
}));
404
403
405
404
it ('should support filters in attribute expressions' , async (() {
406
- var element = $( _.compile (r'''<expr-attr-component expr="'Misko' | hello" one-way="'James' | hello" once="'Chirayu' | hello"></expr-attr-component>''' ) );
405
+ _.compile (r'''<expr-attr-component expr="'Misko' | hello" one-way="'James' | hello" once="'Chirayu' | hello"></expr-attr-component>''' );
407
406
ExprAttrComponent component = _.rootScope.context['exprAttrComponent' ];
408
407
_.rootScope.apply ();
409
408
expect (component.expr).toEqual ('Hello, Misko!' );
@@ -413,12 +412,12 @@ void main() {
413
412
414
413
it ('should error on non-asignable-mapping' , async (() {
415
414
expect (() {
416
- var element = $( _.compile (r'<div><non-assignable-mapping></non-assignable-mapping</div>' ) );
415
+ _.compile (r'<div><non-assignable-mapping></non-assignable-mapping</div>' );
417
416
}).toThrow ("Expression '1+2' is not assignable in mapping '@1+2' for attribute 'attr'." );
418
417
}));
419
418
420
419
it ('should expose mapped attributes as camel case' , async (() {
421
- var element = $( _.compile ('<camel-case-map camel-case=G></camel-case-map>' ) );
420
+ _.compile ('<camel-case-map camel-case=G></camel-case-map>' );
422
421
microLeap ();
423
422
_.rootScope.apply ();
424
423
var componentScope = _.rootScope.context['camelCase' ];
@@ -428,7 +427,7 @@ void main() {
428
427
// TODO: This is a terrible test
429
428
it ('should throw an exception if required directive is missing' , async (() {
430
429
try {
431
- var element = $( _.compile ('<tab local><pane></pane><pane local></pane></tab>' ) );
430
+ _.compile ('<tab local><pane></pane><pane local></pane></tab>' );
432
431
} catch (e) {
433
432
var text = '$e ' ;
434
433
expect (text).toContain ('No provider found for' );
@@ -438,7 +437,7 @@ void main() {
438
437
}));
439
438
440
439
it ('should publish component controller into the scope' , async ((NgZone zone) {
441
- var element = $( _.compile (r'<div><publish-me></publish-me></div>' ) );
440
+ var element = _.compile (r'<div><publish-me></publish-me></div>' );
442
441
microLeap ();
443
442
_.rootScope.apply ();
444
443
expect (element).toHaveText ('WORKED' );
@@ -453,13 +452,13 @@ void main() {
453
452
}));
454
453
455
454
it ('should "publish" controller to injector under provided publishTypes' , () {
456
- var element = $( _.compile (r'<div publish-types></div>' ) );
455
+ _.compile (r'<div publish-types></div>' );
457
456
expect (PublishTypesAttrDirective ._injector.get (PublishTypesAttrDirective )).
458
457
toBe (PublishTypesAttrDirective ._injector.get (PublishTypesDirectiveSuperType ));
459
458
});
460
459
461
460
it ('should allow repeaters over controllers' , async ((Logger logger) {
462
- var element = $( _.compile (r'<log ng-repeat="i in [1, 2]"></log>' ) );
461
+ _.compile (r'<log ng-repeat="i in [1, 2]"></log>' );
463
462
_.rootScope.apply ();
464
463
microLeap ();
465
464
@@ -481,8 +480,8 @@ void main() {
481
480
scope.context['isReady' ] = 'ready' ;
482
481
scope.context['logger' ] = logger;
483
482
scope.context['once' ] = null ;
484
- var element = $ ('<attach-detach attr-value="{{isReady}}" expr-value="isReady" once-value="once">{{logger("inner")}}</attach-detach>' );
485
- $compile (element , _.injector.get (DirectiveMap ))(_.injector.createChild ([new Module ()..value (Scope , scope)]), element );
483
+ var elts = es ('<attach-detach attr-value="{{isReady}}" expr-value="isReady" once-value="once">{{logger("inner")}}</attach-detach>' );
484
+ $compile (elts , _.injector.get (DirectiveMap ))(_.injector.createChild ([new Module ()..value (Scope , scope)]), elts );
486
485
expect (logger).toEqual (['new' ]);
487
486
488
487
expect (logger).toEqual (['new' ]);
@@ -506,14 +505,14 @@ void main() {
506
505
507
506
scope.destroy ();
508
507
expect (logger).toEqual (['detach' ]);
509
- expect (element ).toHaveText ('WORKED' );
508
+ expect (elts ).toHaveText ('WORKED' );
510
509
}));
511
510
512
511
it ('should should not call attach after scope is destroyed' , async ((Compiler $compile, Logger logger, MockHttpBackend backend) {
513
512
backend.whenGET ('foo.html' ).respond ('<div>WORKED</div>' );
514
- var element = $ ('<simple-attach></simple-attach>' );
513
+ var elts = es ('<simple-attach></simple-attach>' );
515
514
var scope = _.rootScope.createChild ({});
516
- $compile (element , _.injector.get (DirectiveMap ))(_.injector.createChild ([new Module ()..value (Scope , scope)]), element );
515
+ $compile (elts , _.injector.get (DirectiveMap ))(_.injector.createChild ([new Module ()..value (Scope , scope)]), elts );
517
516
expect (logger).toEqual (['SimpleAttachComponent' ]);
518
517
scope.destroy ();
519
518
@@ -539,7 +538,7 @@ void main() {
539
538
var c = injector.get (Compiler );
540
539
var directives = injector.get (DirectiveMap );
541
540
expect (() {
542
- c ($ ('<div></div>' ), injector.get (DirectiveMap ));
541
+ c (es ('<div></div>' ), injector.get (DirectiveMap ));
543
542
}).toThrow ('Missing selector annotation for MissingSelector' );
544
543
});
545
544
@@ -552,7 +551,7 @@ void main() {
552
551
var directives = injector.get (DirectiveMap );
553
552
554
553
expect (() {
555
- c ($ ('<div></div>' ), directives);
554
+ c (es ('<div></div>' ), directives);
556
555
}).toThrow ('Unknown selector format \' buttonbar button\' for InvalidSelector' );
557
556
});
558
557
});
@@ -561,7 +560,7 @@ void main() {
561
560
562
561
describe ('controller scoping' , () {
563
562
it ('should make controllers available to sibling and child controllers' , async ((Logger log) {
564
- var element = $( _.compile ('<tab local><pane local></pane><pane local></pane></tab>' ) );
563
+ _.compile ('<tab local><pane local></pane><pane local></pane></tab>' );
565
564
microLeap ();
566
565
567
566
expect (log.result ()).toEqual ('TabComponent-0; LocalAttrDirective-0; PaneComponent-1; LocalAttrDirective-0; PaneComponent-2; LocalAttrDirective-0' );
@@ -571,14 +570,14 @@ void main() {
571
570
// Getting the parent offsets correct while descending the template is tricky. If we get it wrong, this
572
571
// test case will create too many TabCompoenents.
573
572
574
- var element = $( _.compile ('<div ng-bind="true"><div ignore-children></div><tab local><pane local></pane></tab>' ) );
573
+ _.compile ('<div ng-bind="true"><div ignore-children></div><tab local><pane local></pane></tab>' );
575
574
microLeap ();
576
575
577
576
expect (log.result ()).toEqual ('Ignore; TabComponent-0; LocalAttrDirective-0; PaneComponent-1; LocalAttrDirective-0' );
578
577
}));
579
578
580
579
it ('should reuse controllers for transclusions' , async ((Logger log) {
581
- var element = $( _.compile ('<div simple-transclude-in-attach include-transclude>view</div>' ) );
580
+ _.compile ('<div simple-transclude-in-attach include-transclude>view</div>' );
582
581
microLeap ();
583
582
584
583
_.rootScope.apply ();
@@ -613,7 +612,7 @@ void main() {
613
612
describe ('NgDirective' , () {
614
613
it ('should allow creation of a new scope' , () {
615
614
_.rootScope.context['name' ] = 'cover me' ;
616
- $( _.compile ('<div><div my-controller>{{name}}</div></div>' ) );
615
+ _.compile ('<div><div my-controller>{{name}}</div></div>' );
617
616
_.rootScope.apply ();
618
617
expect (_.rootScope.context['name' ]).toEqual ('cover me' );
619
618
expect (_.rootElement.text).toEqual ('MyController' );
0 commit comments