@@ -37,8 +37,7 @@ void main() {
37
37
test ('should be notified of changes' , () async {
38
38
var testBed = new NgTestBed <OnChangeContainer >();
39
39
var testFixture = await testBed.create ();
40
- DebugElement debugElement = getDebugNode (testFixture.rootElement);
41
- var cmp = debugElement.children[0 ].inject (OnChangeComponent );
40
+ var cmp = testFixture.assertOnlyInstance.child;
42
41
expect (cmp.prop, 'hello' );
43
42
expect (cmp.changes.containsKey ('prop' ), true );
44
43
});
@@ -48,8 +47,7 @@ void main() {
48
47
test ('should assign the TemplateRef to a user-defined variable' , () async {
49
48
var testBed = new NgTestBed <MyCompWithTemplateRef >();
50
49
var testFixture = await testBed.create ();
51
- DebugElement debugElement = getDebugNode (testFixture.rootElement);
52
- var refReader = debugElement.childNodes[1 ].componentInstance;
50
+ var refReader = testFixture.assertOnlyInstance.refReaderComponent;
53
51
expect (refReader.ref1, new isInstanceOf <TemplateRef >());
54
52
});
55
53
});
@@ -60,16 +58,15 @@ void main() {
60
58
template: '<template #alice>Unstamped tmp</template>'
61
59
'<ref-reader [ref1]="alice"></ref-reader>' ,
62
60
directives: const [RefReaderComponent ],
63
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
64
- visibility: Visibility .all,
65
61
)
66
- class MyCompWithTemplateRef {}
62
+ class MyCompWithTemplateRef {
63
+ @ViewChild (RefReaderComponent )
64
+ RefReaderComponent refReaderComponent;
65
+ }
67
66
68
67
@Component (
69
68
selector: 'ref-reader' ,
70
69
template: '<div></div>' ,
71
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
72
- visibility: Visibility .all,
73
70
)
74
71
class RefReaderComponent {
75
72
@Input ()
@@ -89,8 +86,6 @@ class NonError {
89
86
selector: 'container-with-propertyaccess' ,
90
87
template: '<property-access></property-access>' ,
91
88
directives: const [PropertyAccess ],
92
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
93
- visibility: Visibility .all,
94
89
)
95
90
class ContainerWithPropertyAccess {
96
91
dynamic value;
@@ -100,8 +95,6 @@ class ContainerWithPropertyAccess {
100
95
selector: 'container-with-no-propertyaccess' ,
101
96
template: '<no-property-access></no-property-access>' ,
102
97
directives: const [NoPropertyAccess ],
103
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
104
- visibility: Visibility .all,
105
98
)
106
99
class ContainerWithNoPropertyAccess {
107
100
dynamic value;
@@ -111,11 +104,12 @@ class ContainerWithNoPropertyAccess {
111
104
selector: 'container-with-onchange' ,
112
105
template: '<on-change [prop]="\' hello\' "></on-change>' ,
113
106
directives: const [OnChangeComponent ],
114
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
115
- visibility: Visibility .all,
116
107
)
117
108
class OnChangeContainer {
118
109
dynamic value;
110
+
111
+ @ViewChild (OnChangeComponent )
112
+ OnChangeComponent child;
119
113
}
120
114
121
115
class PropModel implements Map {
@@ -133,8 +127,6 @@ class PropModel implements Map {
133
127
@Component (
134
128
selector: 'property-access' ,
135
129
template: '''prop:{{model.foo}};map:{{model['foo']}}''' ,
136
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
137
- visibility: Visibility .all,
138
130
)
139
131
class PropertyAccess {
140
132
final model = new PropModel ();
@@ -143,8 +135,6 @@ class PropertyAccess {
143
135
@Component (
144
136
selector: 'no-property-access' ,
145
137
template: '''{{model.doesNotExist}}''' ,
146
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
147
- visibility: Visibility .all,
148
138
)
149
139
class NoPropertyAccess {
150
140
final model = new PropModel ();
@@ -153,8 +143,6 @@ class NoPropertyAccess {
153
143
@Component (
154
144
selector: 'on-change' ,
155
145
template: '' ,
156
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
157
- visibility: Visibility .all,
158
146
)
159
147
class OnChangeComponent implements OnChanges {
160
148
Map changes;
@@ -169,8 +157,6 @@ class OnChangeComponent implements OnChanges {
169
157
170
158
@Directive (
171
159
selector: 'directive-logging-checks' ,
172
- // TODO(b/71710685): Change to `Visibility.local` to reduce code size.
173
- visibility: Visibility .all,
174
160
)
175
161
class DirectiveLoggingChecks implements DoCheck {
176
162
Logger log;
0 commit comments