Skip to content

Commit

Permalink
feat(angular): remove internal storybook properties in storyshot
Browse files Browse the repository at this point in the history
Generates snapshots that will change less if the internal stroybook properties change
  • Loading branch information
ThibaudAV committed Dec 10, 2020
1 parent 2103688 commit bf3a014
Show file tree
Hide file tree
Showing 33 changed files with 64 additions and 403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function getRenderedTree(story: any) {
const tree = TestBed.createComponent(moduleMeta.bootstrap[0] as any);
tree.detectChanges();

return tree;
// Empty componentInstance remove attributes of the internal main component (<storybook-wrapper>) in snapshot
return { ...tree, componentInstance: {} };
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Actions Action and method 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyComponentElementRef={[Function ButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c5=""
ng-reflect-text="Action and Method"
Expand All @@ -24,15 +16,7 @@ exports[`Storyshots Addon/Actions Action and method 1`] = `
`;

exports[`Storyshots Addon/Actions Action only 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyComponentElementRef={[Function ButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c4=""
ng-reflect-text="Action only"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Background background component 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
storyComponentElementRef={[Function AppComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-app-root>
<div
class="hide"
Expand Down Expand Up @@ -67,13 +61,7 @@ exports[`Storyshots Addon/Background background component 1`] = `
`;

exports[`Storyshots Addon/Background background template 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c0=""
ng-reflect-text="Hello Button"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Controls Basic 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
isDisabled="false"
label={[Function String]}
storyComponentElementRef={[Function DocButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<my-button
ng-reflect-is-disabled="false"
ng-reflect-label="Args test"
Expand All @@ -30,15 +22,7 @@ exports[`Storyshots Addon/Controls Basic 1`] = `
`;

exports[`Storyshots Addon/Controls Disabled 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
isDisabled={[Function Boolean]}
label={[Function String]}
storyComponentElementRef={[Function DocButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<my-button
ng-reflect-is-disabled="true"
ng-reflect-label="Disabled"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Docs with some emoji 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c7=""
ng-reflect-text="😀 😎 👍 💯"
Expand All @@ -22,13 +16,7 @@ exports[`Storyshots Addon/Docs with some emoji 1`] = `
`;

exports[`Storyshots Addon/Docs with text 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c6=""
ng-reflect-text="Hello Button"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Jest app.component with jest tests 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
storyComponentElementRef={[Function AppComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-app-root>
<div
class="hide"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Knobs All knobs 1`] = `
<storybook-wrapper
border={[Function String]}
changeDetectorRef={[Function ViewRef_]}
fruit={[Function String]}
items={[Function Array]}
name={[Function String]}
nice={[Function Boolean]}
otherFruit={[Function String]}
price={[Function Number]}
stock={[Function Number]}
storyComponentElementRef={[Function AllKnobsComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
today={[Function Number]}
>
<storybook-wrapper>
<storybook-simple-knobs-component
ng-reflect-border="deeppink"
ng-reflect-fruit="apples"
Expand Down Expand Up @@ -72,14 +57,7 @@ exports[`Storyshots Addon/Knobs All knobs 1`] = `
`;

exports[`Storyshots Addon/Knobs Simple 1`] = `
<storybook-wrapper
age="0"
changeDetectorRef={[Function ViewRef_]}
name={[Function String]}
phoneNumber={[Function String]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<h1>
This is a template
</h1><storybook-simple-knobs-component
Expand All @@ -98,11 +76,7 @@ exports[`Storyshots Addon/Knobs Simple 1`] = `
`;

exports[`Storyshots Addon/Knobs XSS safety 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
&lt;img src=x onerror="alert('XSS Attack')" &gt;
</storybook-wrapper>
`;
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Addon/Links button with link to another story 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyComponentElementRef={[Function ButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c8=""
ng-reflect-text="Go to Welcome Story"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots App Component Component with fullscreen parameters 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
storyComponentElementRef={[Function AppComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-app-root>
<div
class="hide"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Core/Parameters passed to story 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyComponentElementRef={[Function ButtonComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_nghost-a-c9=""
ng-reflect-text="Parameters are {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Custom/ng-content Default 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-with-ng-content>
<div
style="color: #1e88e5;"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Custom/Pipes Simple 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
field={[Function String]}
storyComponentElementRef={[Function NameComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-name
ng-reflect-field="foobar"
>
Expand All @@ -20,14 +13,7 @@ exports[`Storyshots Custom/Pipes Simple 1`] = `
`;

exports[`Storyshots Custom/Pipes With Knobs 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
field={[Function String]}
storyComponentElementRef={[Function NameComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-name
ng-reflect-field="foobar"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Custom/Providers Simple 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
name={[Function String]}
storyComponentElementRef={[Function ServiceComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-simple-service-component
ng-reflect-name="Static name"
>
Expand All @@ -23,14 +16,7 @@ exports[`Storyshots Custom/Providers Simple 1`] = `
`;

exports[`Storyshots Custom/Providers With knobs 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
name={[Function String]}
storyComponentElementRef={[Function ServiceComponent]}
storyComponentViewContainerRef={[Function ViewContainerRef_]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
>
<storybook-wrapper>
<storybook-simple-service-component
ng-reflect-name="Dynamic knob"
>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Storyshots Custom/Style Default 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_ngcontent-a-c10=""
_nghost-a-c11=""
Expand All @@ -23,13 +17,7 @@ exports[`Storyshots Custom/Style Default 1`] = `
`;

exports[`Storyshots Custom/Style With Knobs 1`] = `
<storybook-wrapper
changeDetectorRef={[Function ViewRef_]}
onClick={[Function Function]}
storyProps$={[Function Observable]}
storyPropsSubscription={[Function Subscriber]}
text={[Function String]}
>
<storybook-wrapper>
<storybook-button-component
_ngcontent-a-c12=""
_nghost-a-c13=""
Expand Down
Loading

0 comments on commit bf3a014

Please sign in to comment.