Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interactions: Add step function and support multiple levels of nesting #18555

Merged
merged 51 commits into from
Aug 19, 2022
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
ee3fe71
Add step function and support for deeply nested interactions
ghengeveld Jun 23, 2022
9c427fe
Fix bubbling multiple levels
ghengeveld Jun 23, 2022
fc1d62d
Refactor stories to use step function
ghengeveld Jun 24, 2022
b2a18cf
Pull example stories into their own file
ghengeveld Jun 24, 2022
884e410
Move examples to separate directory
ghengeveld Jun 24, 2022
890d94a
Stories for step function
ghengeveld Jun 24, 2022
b646774
Document step function
ghengeveld Jun 24, 2022
34ff0a4
Concrete type for playContext
ghengeveld Jun 24, 2022
7c92060
Drop needless async keyword
ghengeveld Jun 24, 2022
1b58c18
Remove unused import
ghengeveld Jun 24, 2022
5f5009e
Fix step type definition
ghengeveld Jun 24, 2022
c2ce170
Fix step function injection
ghengeveld Jun 28, 2022
be40bce
Namespace events to storybook
ghengeveld Jun 28, 2022
09a302b
Fix tests
ghengeveld Jun 28, 2022
63d2f98
Merge branch 'future/base' into ghengeveld/ap-1859-generic-step-function
ghengeveld Jul 8, 2022
640072e
Pass playContext to step function
ghengeveld Jul 8, 2022
26ec0e6
Fix signature
ghengeveld Jul 8, 2022
6f4ca17
Merge branch 'next' into ghengeveld/ap-1859-generic-step-function
ghengeveld Aug 4, 2022
b6f9fe5
Fix mock data
ghengeveld Aug 4, 2022
931af52
Fix weird async behavior
ghengeveld Aug 4, 2022
697c8ea
Add default runStep function and export one from interactions addon
ghengeveld Aug 4, 2022
e05b07d
Use proper types
ghengeveld Aug 4, 2022
0ba8a5e
Instrument the step runner provided by the interactions addon
ghengeveld Aug 5, 2022
4909898
Add addon-interactions to be able to see the labeled step
ghengeveld Aug 5, 2022
226e211
Better label
ghengeveld Aug 5, 2022
9b81022
Get rid of dependency on instrumenter from preview-web
ghengeveld Aug 5, 2022
7538375
No need for explicit default implementation, composeStepRunners takes…
ghengeveld Aug 5, 2022
4c90cfd
Update lockfile
ghengeveld Aug 5, 2022
9319812
Add missing await keywords
ghengeveld Aug 9, 2022
64c950b
Fix formatting in docs
ghengeveld Aug 9, 2022
51d74a7
Move MaybePromise to Preview.ts
ghengeveld Aug 9, 2022
f46a08c
Drop unused stepFunction property and its type definition
ghengeveld Aug 9, 2022
501b7e1
Always return chained promise so state will be restored before execut…
ghengeveld Aug 10, 2022
118fe17
Add test for step runner composition
ghengeveld Aug 10, 2022
7970c89
Avoid step function in official-storybook for now
ghengeveld Aug 10, 2022
24fb939
Fix projectAnnotations
ghengeveld Aug 10, 2022
5e56ec8
Revert "Avoid step function in official-storybook for now"
ghengeveld Aug 10, 2022
3a61646
Merge branch 'next' into ghengeveld/ap-1859-generic-step-function
ghengeveld Aug 12, 2022
2a70b8a
Fix step function in StoryStore v6
ghengeveld Aug 12, 2022
6a47756
Load step runner in Storyshots
ghengeveld Aug 12, 2022
d76bbba
Fix interactions count
ghengeveld Aug 15, 2022
60c6653
Fix collapse to bust memoization
ghengeveld Aug 15, 2022
ff5e9e8
Nobody cares about the number of items to hide
ghengeveld Aug 15, 2022
44b17e9
Merge branch 'next' into ghengeveld/ap-1859-generic-step-function
ghengeveld Aug 16, 2022
18dea52
Fix interactions count with collapsed items
ghengeveld Aug 16, 2022
b3585b9
Remove log statement
ghengeveld Aug 16, 2022
cd0fe4e
Fix debugger behavior by ensuring we sync then jumping to the start
ghengeveld Aug 17, 2022
8de3948
Merge branch 'next' into ghengeveld/ap-1859-generic-step-function
ghengeveld Aug 17, 2022
5c0755f
Flip boolean arg to have workable fallback
ghengeveld Aug 17, 2022
9bd934a
Update test
ghengeveld Aug 17, 2022
bfa4326
Merge branch 'next' into ghengeveld/ap-1859-generic-step-function
ghengeveld Aug 19, 2022
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
Prev Previous commit
Next Next commit
Add test for step runner composition
ghengeveld committed Aug 10, 2022
commit 118fe17652b327258a268550db676a8fbef0980c
18 changes: 18 additions & 0 deletions code/lib/store/src/csf/composeConfigs.test.ts
Original file line number Diff line number Diff line change
@@ -157,4 +157,22 @@ describe('composeConfigs', () => {
runStep: expect.any(Function),
});
});

it('composes step runners', () => {
const fn = jest.fn();

const { runStep } = composeConfigs([
{ runStep: (label, play, context) => fn(`${label}1`, play(context)) },
{ runStep: (label, play, context) => fn(`${label}2`, play(context)) },
{ runStep: (label, play, context) => fn(`${label}3`, play(context)) },
]);

// @ts-expect-error We don't care about the context value here
runStep('Label', () => {}, {});

expect(fn).toHaveBeenCalledTimes(3);
expect(fn).toHaveBeenNthCalledWith(1, 'Label3', expect.anything());
expect(fn).toHaveBeenNthCalledWith(2, 'Label2', expect.anything());
expect(fn).toHaveBeenNthCalledWith(3, 'Label1', expect.anything());
});
});