Skip to content

Commit

Permalink
geosolutions-it#9250: Save permalink description as metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuren1 committed Jul 26, 2023
1 parent a00d669 commit 4d4ccfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions web/client/components/permalink/Permalink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ export default ({
permalinkType: pathInfo.type,
resource: {
category: "PERMALINK",
metadata: {name: uuid()},
metadata: {name: uuid(), description: settings.description},
attributes: {
...pathInfo,
title: settings.title,
description: settings.description
title: settings.title
}
},
allowAllUser: settings.allowAllUser
Expand Down
4 changes: 3 additions & 1 deletion web/client/components/permalink/__tests__/Permalink-test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,16 @@ describe('Permalink tests', () => {
};

const onSaveSpy = expect.spyOn(actions, 'onSave');
ReactDOM.render(<Permalink onSave={actions.onSave} shareUrl="#/viewer/22" settings={{title: "name"}} />, document.getElementById("container"));
ReactDOM.render(<Permalink onSave={actions.onSave} shareUrl="#/viewer/22" settings={{title: "name", description: "test-description"}} />, document.getElementById("container"));
expect(document.getElementById('permalink')).toBeTruthy();
const button = document.querySelector('button');
TestUtils.Simulate.click(button);
expect(onSaveSpy).toHaveBeenCalled();
const args = onSaveSpy.calls[0].arguments[0];
expect(args.permalinkType).toBe('map');
expect(args.resource.category).toBe('PERMALINK');
expect(args.resource.metadata).toBeTruthy();
expect(args.resource.metadata.description).toBe("test-description");
expect(args.resource.attributes).toBeTruthy();
expect(args.resource.attributes.pathTemplate).toBe("/viewer/${id}");
});
Expand Down

0 comments on commit 4d4ccfd

Please sign in to comment.