Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

Commit d4d8fae

Browse files
leonsenftalorenzen
authored andcommitted
Removes use of debug injector that required directive to have Visibility.all
PiperOrigin-RevId: 186557389
1 parent c6cdee8 commit d4d8fae

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

_tests/test/core/linker/integration_dart_test.dart

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ void main() {
3737
test('should be notified of changes', () async {
3838
var testBed = new NgTestBed<OnChangeContainer>();
3939
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;
4241
expect(cmp.prop, 'hello');
4342
expect(cmp.changes.containsKey('prop'), true);
4443
});
@@ -48,8 +47,7 @@ void main() {
4847
test('should assign the TemplateRef to a user-defined variable', () async {
4948
var testBed = new NgTestBed<MyCompWithTemplateRef>();
5049
var testFixture = await testBed.create();
51-
DebugElement debugElement = getDebugNode(testFixture.rootElement);
52-
var refReader = debugElement.childNodes[1].componentInstance;
50+
var refReader = testFixture.assertOnlyInstance.refReaderComponent;
5351
expect(refReader.ref1, new isInstanceOf<TemplateRef>());
5452
});
5553
});
@@ -60,16 +58,15 @@ void main() {
6058
template: '<template #alice>Unstamped tmp</template>'
6159
'<ref-reader [ref1]="alice"></ref-reader>',
6260
directives: const [RefReaderComponent],
63-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
64-
visibility: Visibility.all,
6561
)
66-
class MyCompWithTemplateRef {}
62+
class MyCompWithTemplateRef {
63+
@ViewChild(RefReaderComponent)
64+
RefReaderComponent refReaderComponent;
65+
}
6766

6867
@Component(
6968
selector: 'ref-reader',
7069
template: '<div></div>',
71-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
72-
visibility: Visibility.all,
7370
)
7471
class RefReaderComponent {
7572
@Input()
@@ -89,8 +86,6 @@ class NonError {
8986
selector: 'container-with-propertyaccess',
9087
template: '<property-access></property-access>',
9188
directives: const [PropertyAccess],
92-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
93-
visibility: Visibility.all,
9489
)
9590
class ContainerWithPropertyAccess {
9691
dynamic value;
@@ -100,8 +95,6 @@ class ContainerWithPropertyAccess {
10095
selector: 'container-with-no-propertyaccess',
10196
template: '<no-property-access></no-property-access>',
10297
directives: const [NoPropertyAccess],
103-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
104-
visibility: Visibility.all,
10598
)
10699
class ContainerWithNoPropertyAccess {
107100
dynamic value;
@@ -111,11 +104,12 @@ class ContainerWithNoPropertyAccess {
111104
selector: 'container-with-onchange',
112105
template: '<on-change [prop]="\'hello\'"></on-change>',
113106
directives: const [OnChangeComponent],
114-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
115-
visibility: Visibility.all,
116107
)
117108
class OnChangeContainer {
118109
dynamic value;
110+
111+
@ViewChild(OnChangeComponent)
112+
OnChangeComponent child;
119113
}
120114

121115
class PropModel implements Map {
@@ -133,8 +127,6 @@ class PropModel implements Map {
133127
@Component(
134128
selector: 'property-access',
135129
template: '''prop:{{model.foo}};map:{{model['foo']}}''',
136-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
137-
visibility: Visibility.all,
138130
)
139131
class PropertyAccess {
140132
final model = new PropModel();
@@ -143,8 +135,6 @@ class PropertyAccess {
143135
@Component(
144136
selector: 'no-property-access',
145137
template: '''{{model.doesNotExist}}''',
146-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
147-
visibility: Visibility.all,
148138
)
149139
class NoPropertyAccess {
150140
final model = new PropModel();
@@ -153,8 +143,6 @@ class NoPropertyAccess {
153143
@Component(
154144
selector: 'on-change',
155145
template: '',
156-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
157-
visibility: Visibility.all,
158146
)
159147
class OnChangeComponent implements OnChanges {
160148
Map changes;
@@ -169,8 +157,6 @@ class OnChangeComponent implements OnChanges {
169157

170158
@Directive(
171159
selector: 'directive-logging-checks',
172-
// TODO(b/71710685): Change to `Visibility.local` to reduce code size.
173-
visibility: Visibility.all,
174160
)
175161
class DirectiveLoggingChecks implements DoCheck {
176162
Logger log;

0 commit comments

Comments
 (0)