Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export const createStorybookWrapperComponent = ({
styles: string[];
moduleMetadata: NgModuleMetadata;
initialProps?: ICollection;
analyzedMetadata?: PropertyExtractor;
analyzedMetadata: PropertyExtractor;
}): Type<any> => {
// In ivy, a '' selector is not allowed, therefore we need to just set it to anything if
// storyComponent was not provided.
Expand Down
1 change: 1 addition & 0 deletions code/frameworks/angular/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';