9
9
import { ComponentFixture , TestBed } from '@angular/core/testing' ;
10
10
import { By } from '@angular/platform-browser' ;
11
11
import { BehaviorSubject } from 'rxjs' ;
12
- import { NG_EVENT_PLUGINS } from '../constants/plugins' ;
13
12
import { shouldCall } from '../decorators/should-call' ;
13
+ import { EventPluginsModule } from '../module' ;
14
14
import { asCallable } from '../utils/as-callable' ;
15
15
16
16
describe ( 'EventManagers' , ( ) => {
@@ -33,11 +33,11 @@ describe('EventManagers', () => {
33
33
(click.silent)="onFilteredClicks($event.bubbles)"
34
34
></div>
35
35
</div>
36
- <div class="wrapper" (click.capture.stop)="noop( )">
36
+ <div class="wrapper" (click.capture.stop)="(0 )">
37
37
<div id="captured-clicks" class="element" (click)="onCaptured()"></div>
38
38
</div>
39
39
<div class="wrapper" (click.self)="onBubbled()">
40
- <div id="bubbled-clicks" class="element" (click)="noop( )"></div>
40
+ <div id="bubbled-clicks" class="element" (click)="(0 )"></div>
41
41
</div>
42
42
` ,
43
43
changeDetection : ChangeDetectionStrategy . OnPush ,
@@ -54,8 +54,8 @@ describe('EventManagers', () => {
54
54
@HostListener ( '$.data-value.attr' )
55
55
@HostBinding ( '$.tabIndex' )
56
56
@HostListener ( '$.tabIndex' )
57
- @HostBinding ( '$.style.width .%' )
58
- @HostListener ( '$.style.width .%' )
57
+ @HostBinding ( '$.style.marginTop .%' )
58
+ @HostListener ( '$.style.marginTop .%' )
59
59
@HostBinding ( '$.class.active' )
60
60
@HostListener ( '$.class.active' )
61
61
readonly test = asCallable ( new BehaviorSubject < number | null > ( 1 ) ) ;
@@ -69,25 +69,21 @@ describe('EventManagers', () => {
69
69
onFilteredClicks ( _bubbles : boolean ) {
70
70
this . flag = true ;
71
71
}
72
-
73
- noop ( ) { }
74
72
}
75
73
76
74
@Component ( {
77
- template : `<div (document:click.capture)="noop( )"></div>` ,
75
+ template : `<div (document:click.capture)="(0 )"></div>` ,
78
76
changeDetection : ChangeDetectionStrategy . OnPush ,
79
77
} )
80
- class BrokenComponent {
81
- noop ( ) { }
82
- }
78
+ class BrokenComponent { }
83
79
84
80
let fixture : ComponentFixture < TestComponent > ;
85
81
let testComponent : TestComponent ;
86
82
87
83
beforeEach ( ( ) => {
88
84
TestBed . configureTestingModule ( {
85
+ imports : [ EventPluginsModule ] ,
89
86
declarations : [ TestComponent , BrokenComponent ] ,
90
- providers : NG_EVENT_PLUGINS ,
91
87
} ) ;
92
88
93
89
fixture = TestBed . createComponent ( TestComponent ) ;
@@ -195,7 +191,7 @@ describe('EventManagers', () => {
195
191
'1' ,
196
192
) ;
197
193
expect ( testComponent . elementRef . nativeElement . tabIndex ) . toBe ( 1 ) ;
198
- expect ( testComponent . elementRef . nativeElement . style . width ) . toBe ( '1%' ) ;
194
+ expect ( testComponent . elementRef . nativeElement . style . marginTop ) . toBe ( '1%' ) ;
199
195
expect ( testComponent . elementRef . nativeElement . classList . contains ( 'active' ) ) . toBe (
200
196
true ,
201
197
) ;
@@ -208,7 +204,7 @@ describe('EventManagers', () => {
208
204
null ,
209
205
) ;
210
206
expect ( testComponent . elementRef . nativeElement . tabIndex ) . toBe ( 0 ) ;
211
- expect ( testComponent . elementRef . nativeElement . style . width ) . toBe ( '1%' ) ;
207
+ expect ( testComponent . elementRef . nativeElement . style . marginTop ) . toBe ( '1%' ) ;
212
208
expect ( testComponent . elementRef . nativeElement . classList . contains ( 'active' ) ) . toBe (
213
209
false ,
214
210
) ;
0 commit comments