Skip to content

Commit

Permalink
Remove deprecated component and propsMeta field from Angular Stor…
Browse files Browse the repository at this point in the history
…y type
  • Loading branch information
valentinpalkovic committed Mar 30, 2023
1 parent 4029c71 commit 9baf46a
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 209 deletions.
5 changes: 5 additions & 0 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- [Postcss removed](#postcss-removed)
- [Removed DLL flags](#removed-dll-flags)
- [7.0 Framework-specific changes](#70-framework-specific-changes)
- [Angular: Removed deprecated `component` and `propsMeta` field](#angular-removed-deprecated-component-and-propsmeta-field)
- [Angular: Drop support for Angular \< 14](#angular-drop-support-for-angular--14)
- [Angular: Drop support for calling Storybook directly](#angular-drop-support-for-calling-storybook-directly)
- [Angular: Application providers and ModuleWithProviders](#angular-application-providers-and-modulewithproviders)
Expand Down Expand Up @@ -921,6 +922,10 @@ Earlier versions of Storybook used Webpack DLLs as a performance crutch. In 6.1,

### 7.0 Framework-specific changes

#### Angular: Removed deprecated `component` and `propsMeta` field

The deprecated fields `component` and `propsMeta` on the NgStory type have been removed.

#### Angular: Drop support for Angular < 14

Starting in 7.0, we drop support for Angular < 14
Expand Down
4 changes: 0 additions & 4 deletions code/addons/storyshots-core/src/frameworks/angular/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ export interface ICollection {
}

export interface NgStory {
/** @deprecated `component` story input is deprecated, and will be removed in Storybook 7.0. */
component?: any;
props: ICollection;
/** @deprecated `propsMeta` story input is deprecated, and will be removed in Storybook 7.0. */
propsMeta?: ICollection;
moduleMetadata?: NgModuleMetadata;
template?: string;
}
155 changes: 0 additions & 155 deletions code/frameworks/angular/src/client/angular/app.component.ts

This file was deleted.

4 changes: 0 additions & 4 deletions code/frameworks/angular/src/client/angular/app.token.ts

This file was deleted.

34 changes: 0 additions & 34 deletions code/frameworks/angular/src/client/decorateStory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,40 +194,6 @@ describe('decorateStory', () => {
});
});

it('should include legacy story components in decorators', () => {
const decorators: DecoratorFunction<AngularRenderer>[] = [
(s) => {
const story = s();
return {
...story,
template: `<parent>${story.template}</parent>`,
};
},
(s) => {
const story = s();
return {
...story,
template: `<grandparent>${story.template}</grandparent>`,
};
},
(s) => {
const story = s();
return {
...story,
template: `<great-grandparent>${story.template}</great-grandparent>`,
};
},
];
const decorated = decorateStory(() => ({ component: FooComponent }), decorators);

expect(decorated(makeContext({}))).toEqual({
template:
'<great-grandparent><grandparent><parent><foo></foo></parent></grandparent></great-grandparent>',
component: FooComponent,
userDefinedTemplate: false,
});
});

it('should keep template with an empty value', () => {
const decorators: DecoratorFunction<AngularRenderer>[] = [
componentWrapperDecorator(ParentComponent),
Expand Down
5 changes: 1 addition & 4 deletions code/frameworks/angular/src/client/decorators.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ describe('moduleMetadata', () => {
imports: [MockModule],
providers: [MockService],
})(
() => ({
component: MockComponent,
}),
() => ({}),
// deepscan-disable-next-line
defaultContext
);

expect(result).toEqual({
component: MockComponent,
moduleMetadata: {
declarations: [],
entryComponents: [],
Expand Down
4 changes: 0 additions & 4 deletions code/frameworks/angular/src/client/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ export interface ICollection {
}

export interface StoryFnAngularReturnType {
/** @deprecated `component` story input is deprecated, and will be removed in Storybook 7.0. */
component?: any;
props?: ICollection;
/** @deprecated `propsMeta` story input is deprecated, and will be removed in Storybook 7.0. */
propsMeta?: ICollection;
moduleMetadata?: NgModuleMetadata;
applicationConfig?: ApplicationConfig;
template?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { OnDestroy, OnInit, Component } from '@angular/core';
import { Meta, StoryFn } from '@storybook/angular';
import { Meta, StoryObj } from '@storybook/angular';

@Component({
selector: 'on-destroy',
Expand Down Expand Up @@ -37,6 +37,4 @@ export default {
},
} as Meta;

export const SimpleComponent: StoryFn = () => ({
component: OnDestroyComponent,
});
export const SimpleComponent: StoryObj = {};

0 comments on commit 9baf46a

Please sign in to comment.