Skip to content

Commit

Permalink
feat(smart-action): handle isReadOnly field in smart action forms (#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeCisco authored Apr 12, 2021
1 parent c59dfc8 commit 4de9540
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/serializers/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function SchemaSerializer() {
'defaultValue',
'enums',
'isRequired',
'isReadOnly',
'reference',
'description',
'position',
Expand Down
22 changes: 21 additions & 1 deletion test/services/schema-file-updater.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('services > schema-file-updater', () => {
});

it('should format action', () => {
expect.assertions(2);
expect.assertions(3);
const schema = buildSchema([{
name: 'collectionName',
actions: [
Expand All @@ -138,6 +138,14 @@ describe('services > schema-file-updater', () => {
enums: ['yes', 'no'],
}],
},
{
name: 'thirdActionName',
fields: [{
field: 'someOtherField',
description: 'This action will \r\n do something',
isReadOnly: true,
}],
},
],
}]);
expect(schema.collections[0].actions[0]).toStrictEqual({
Expand All @@ -162,6 +170,18 @@ describe('services > schema-file-updater', () => {
position: 0,
widget: null,
});
expect(schema.collections[0].actions[2].fields[0]).toStrictEqual({
field: 'someOtherField',
type: 'String',
defaultValue: null,
isRequired: false,
reference: null,
description: 'This action will \r\n do something',
position: 0,
widget: null,
enums: null,
isReadOnly: true,
});
});

it('should format action hooks', () => {
Expand Down

0 comments on commit 4de9540

Please sign in to comment.