Skip to content

Commit

Permalink
Revert "fix(root): Remove ViewChild from metadata"
Browse files Browse the repository at this point in the history
This reverts commit 4421a1c.
  • Loading branch information
dmitry-stepanenko committed May 28, 2024
1 parent 4421a1c commit 5c98e73
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 4 deletions.
5 changes: 1 addition & 4 deletions libs/ng-mocks/src/lib/common/decorate.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ const generateFinalQueries = (queries: {

for (const key of Object.keys(queries)) {
const query: Query & { ngMetadataName?: string } = queries[key];

if (!query.isViewQuery || isInternalKey(key)) {
final.push([key, query]);
}
final.push([key, query]);

if (!query.isViewQuery && !isInternalKey(key)) {
scanKeys.push(key);
Expand Down
32 changes: 32 additions & 0 deletions libs/ng-mocks/src/lib/mock-component/mock-component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,22 @@ describe('MockComponent', () => {
ngMetadataName: 'ContentChildren',
}),
],
o3: [
jasmine.objectContaining({
selector: 'i3',
isViewQuery: true,
read: TemplateRef,
ngMetadataName: 'ViewChild',
}),
],
o4: [
jasmine.objectContaining({
selector: 'i4',
isViewQuery: true,
read: TemplateRef,
ngMetadataName: 'ViewChildren',
}),
],
o5: [
jasmine.objectContaining({
selector: 'i5',
Expand All @@ -409,6 +425,22 @@ describe('MockComponent', () => {
ngMetadataName: 'ContentChildren',
}),
],
o7: [
jasmine.objectContaining({
selector: 'i7',
isViewQuery: true,
read: ElementRef,
ngMetadataName: 'ViewChild',
}),
],
o8: [
jasmine.objectContaining({
selector: 'i8',
isViewQuery: true,
read: ElementRef,
ngMetadataName: 'ViewChildren',
}),
],

__ngMocksVcr_o1: [
jasmine.objectContaining({
Expand Down
32 changes: 32 additions & 0 deletions libs/ng-mocks/src/lib/mock-directive/mock-directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,22 @@ describe('MockDirective', () => {
ngMetadataName: 'ContentChildren',
}),
],
o3: [
jasmine.objectContaining({
selector: 'i3',
isViewQuery: true,
read: TemplateRef,
ngMetadataName: 'ViewChild',
}),
],
o4: [
jasmine.objectContaining({
selector: 'i4',
isViewQuery: true,
read: TemplateRef,
ngMetadataName: 'ViewChildren',
}),
],
o5: [
jasmine.objectContaining({
selector: 'i5',
Expand All @@ -316,6 +332,22 @@ describe('MockDirective', () => {
ngMetadataName: 'ContentChildren',
}),
],
o7: [
jasmine.objectContaining({
selector: 'i7',
isViewQuery: true,
read: ElementRef,
ngMetadataName: 'ViewChild',
}),
],
o8: [
jasmine.objectContaining({
selector: 'i8',
isViewQuery: true,
read: ElementRef,
ngMetadataName: 'ViewChildren',
}),
],

__ngMocksVcr_o1: [
jasmine.objectContaining({
Expand Down

0 comments on commit 5c98e73

Please sign in to comment.