Skip to content

Commit

Permalink
test(gv-schema-form): improve stories with save simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
gcusnieux committed Jun 14, 2021
1 parent 67241a6 commit 305180d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions stories/policy-studio/gv-policy-studio.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ const fetchResourceDocumentation = (event) => {
}
};

const save = (event) => {
event.target.definition = event.detail.definition;
};

export const Empty = makeStory(conf, {
items: [
{
Expand All @@ -118,6 +122,7 @@ export const Empty = makeStory(conf, {
apiConfigurationSchema: apimConfiguration,
'@gv-resources:fetch-documentation': fetchResourceDocumentation.bind(this),
'@gv-policy-studio:fetch-documentation': fetchPolicyDocumentation.bind(this),
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand Down Expand Up @@ -146,6 +151,7 @@ export const APIM = makeStory(conf, {
'has-policy-filter': true,
'can-add': true,
sortable: true,
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand Down Expand Up @@ -203,6 +209,7 @@ export const APIMWithoutPlans = makeStory(conf, {
'has-policy-filter': true,
'can-add': true,
sortable: true,
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand Down Expand Up @@ -231,6 +238,7 @@ export const APIMWithEmptyPlans = makeStory(conf, {
'has-policy-filter': true,
'can-add': true,
sortable: true,
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand Down Expand Up @@ -260,6 +268,7 @@ export const APIMWithReadonlyPlans = makeStory(conf, {
'can-add': true,
sortable: true,
'readonly-plans': true,
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand All @@ -274,6 +283,7 @@ export const AM = makeStory(conf, {
definition: amDefinition,
flowSchema: amForm,
'@gv-policy-studio:fetch-documentation': fetchPolicyDocumentation.bind(this),
'@gv-policy-studio:save': save.bind(this),
},
],
});
Expand All @@ -289,6 +299,7 @@ export const AMEditable = makeStory(conf, {
flowSchema: amForm,
'@gv-policy-studio:fetch-documentation': fetchPolicyDocumentation.bind(this),
'can-add': true,
'@gv-policy-studio:save': save.bind(this),
},
],
});
3 changes: 2 additions & 1 deletion stories/resources/am-definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
{
"name": "ALL",
"type": "ROOT",
"pre": []
"pre": [],
"post": []
},
{
"name": "LOGIN",
Expand Down

0 comments on commit 305180d

Please sign in to comment.