diff --git a/code/addons/storyshots-core/src/frameworks/angular/renderTree.ts b/code/addons/storyshots-core/src/frameworks/angular/renderTree.ts index 9de180774184..3c501c70dcc5 100644 --- a/code/addons/storyshots-core/src/frameworks/angular/renderTree.ts +++ b/code/addons/storyshots-core/src/frameworks/angular/renderTree.ts @@ -2,7 +2,7 @@ import AngularSnapshotSerializer from 'jest-preset-angular/build/serializers/ng- import HTMLCommentSerializer from 'jest-preset-angular/build/serializers/html-comment'; import { TestBed } from '@angular/core/testing'; import { addSerializer } from 'jest-specific-snapshot'; -import { getApplication, storyPropsProvider } from '@storybook/angular/renderer'; +import { getApplication, storyPropsProvider, PropertyExtractor } from '@storybook/angular/renderer'; import { BehaviorSubject } from 'rxjs'; addSerializer(HTMLCommentSerializer); @@ -11,11 +11,14 @@ addSerializer(AngularSnapshotSerializer); function getRenderedTree(story: any) { const currentStory = story.render(); + const analyzedMetadata = new PropertyExtractor(currentStory.moduleMetadata, story.component); + const application = getApplication({ storyFnAngular: currentStory, component: story.component, // TODO : To change with the story Id in v7. Currently keep with static id to avoid changes in snapshots targetSelector: 'storybook-wrapper', + analyzedMetadata, }); TestBed.configureTestingModule({ diff --git a/code/frameworks/angular/src/client/angular-beta/StorybookModule.ts b/code/frameworks/angular/src/client/angular-beta/StorybookModule.ts index f4c01547b734..3535a85c6988 100644 --- a/code/frameworks/angular/src/client/angular-beta/StorybookModule.ts +++ b/code/frameworks/angular/src/client/angular-beta/StorybookModule.ts @@ -12,7 +12,7 @@ export const getApplication = ({ storyFnAngular: StoryFnAngularReturnType; component?: any; targetSelector: string; - analyzedMetadata?: PropertyExtractor; + analyzedMetadata: PropertyExtractor; }) => { const { props, styles, moduleMetadata = {} } = storyFnAngular; let { template } = storyFnAngular; diff --git a/code/frameworks/angular/src/client/angular-beta/StorybookWrapperComponent.ts b/code/frameworks/angular/src/client/angular-beta/StorybookWrapperComponent.ts index ea4a8767556a..aa5bd589d123 100644 --- a/code/frameworks/angular/src/client/angular-beta/StorybookWrapperComponent.ts +++ b/code/frameworks/angular/src/client/angular-beta/StorybookWrapperComponent.ts @@ -52,7 +52,7 @@ export const createStorybookWrapperComponent = ({ styles: string[]; moduleMetadata: NgModuleMetadata; initialProps?: ICollection; - analyzedMetadata?: PropertyExtractor; + analyzedMetadata: PropertyExtractor; }): Type => { // In ivy, a '' selector is not allowed, therefore we need to just set it to anything if // storyComponent was not provided. diff --git a/code/frameworks/angular/src/renderer.ts b/code/frameworks/angular/src/renderer.ts index 11d729059f2f..a88691381c84 100644 --- a/code/frameworks/angular/src/renderer.ts +++ b/code/frameworks/angular/src/renderer.ts @@ -3,3 +3,4 @@ export { computesTemplateSourceFromComponent } from './client/angular-beta/Compu export { rendererFactory } from './client/render'; export { AbstractRenderer } from './client/angular-beta/AbstractRenderer'; export { getApplication } from './client/angular-beta/StorybookModule'; +export { PropertyExtractor } from './client/angular-beta/utils/PropertyExtractor';