cozy-sharing 31.0.2 → 31.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/components/FederatedFolder/DumbFederatedFolderModal.js +15 -16
  3. package/dist/components/FederatedFolder/FederatedFolderModal.js +78 -103
  4. package/dist/components/FederatedFolder/FederatedFolderModal.spec.js +102 -292
  5. package/dist/components/Recipient/GroupRecipientPermissions.js +15 -11
  6. package/dist/components/Recipient/LinkRecipient.js +15 -11
  7. package/dist/components/Recipient/LinkRecipientLite.js +1 -1
  8. package/dist/components/Recipient/LinkRecipientPermissions.js +2 -1
  9. package/dist/components/Recipient/MemberRecipient.spec.js +8 -10
  10. package/dist/components/Recipient/MemberRecipientLite.js +1 -1
  11. package/dist/components/Recipient/MemberRecipientPermissions.js +16 -12
  12. package/dist/components/Recipient/MemberRecipientPermissions.spec.js +62 -50
  13. package/dist/components/Recipient/RecipientConfirm.js +0 -5
  14. package/dist/components/ShareAutosuggest.js +9 -4
  15. package/dist/components/ShareByEmail.js +29 -274
  16. package/dist/components/ShareByEmail.spec.js +52 -230
  17. package/dist/components/ShareByLink.js +1 -3
  18. package/dist/components/ShareDialogCozyToCozy.js +169 -35
  19. package/dist/components/ShareDialogCozyToCozy.spec.js +123 -36
  20. package/dist/components/ShareDialogTwoStepsConfirmationContainer.js +13 -3
  21. package/dist/components/ShareModal/SharingDetailsModal.js +0 -5
  22. package/dist/components/ShareRecipientsInput.js +6 -3
  23. package/dist/components/SharedDrive/SharedDriveForm.js +17 -25
  24. package/dist/components/SharedDrive/SharedDriveModal.js +1 -1
  25. package/dist/components/SharedDrive/SharedDriveRecipientPermissions.js +15 -10
  26. package/dist/components/SharedDrive/useSharedDrive.js +33 -57
  27. package/dist/components/SharedDrive/useSharedDrive.spec.js +29 -93
  28. package/dist/components/SharedFolder/DumbBatchSharedFolderModal.js +15 -26
  29. package/dist/components/Sharetypeselect.js +85 -90
  30. package/dist/hooks/usePendingRecipients.js +20 -0
  31. package/dist/hooks/usePendingRecipients.spec.js +30 -0
  32. package/dist/styles/autosuggest.styl +8 -2
  33. package/dist/styles/share.styl +0 -39
  34. package/dist/stylesheet.css +8 -36
  35. package/locales/en.json +14 -44
  36. package/locales/fr.json +14 -44
  37. package/locales/ru.json +14 -44
  38. package/locales/vi.json +14 -42
  39. package/package.json +2 -2
  40. package/src/components/FederatedFolder/DumbFederatedFolderModal.jsx +14 -15
  41. package/src/components/FederatedFolder/FederatedFolderModal.jsx +50 -67
  42. package/src/components/FederatedFolder/FederatedFolderModal.spec.jsx +63 -186
  43. package/src/components/Recipient/GroupRecipientPermissions.jsx +15 -13
  44. package/src/components/Recipient/LinkRecipient.jsx +9 -9
  45. package/src/components/Recipient/LinkRecipientLite.jsx +1 -3
  46. package/src/components/Recipient/LinkRecipientPermissions.jsx +2 -1
  47. package/src/components/Recipient/MemberRecipient.spec.jsx +4 -6
  48. package/src/components/Recipient/MemberRecipientLite.jsx +2 -2
  49. package/src/components/Recipient/MemberRecipientPermissions.jsx +16 -21
  50. package/src/components/Recipient/MemberRecipientPermissions.spec.jsx +21 -23
  51. package/src/components/ShareAutosuggest.jsx +7 -2
  52. package/src/components/ShareByEmail.jsx +35 -186
  53. package/src/components/ShareByEmail.spec.jsx +22 -173
  54. package/src/components/ShareByLink.jsx +1 -7
  55. package/src/components/ShareDialogCozyToCozy.jsx +171 -38
  56. package/src/components/ShareDialogCozyToCozy.spec.jsx +67 -1
  57. package/src/components/ShareDialogTwoStepsConfirmationContainer.jsx +11 -1
  58. package/src/components/ShareRecipientsInput.jsx +5 -2
  59. package/src/components/SharedDrive/SharedDriveForm.jsx +16 -25
  60. package/src/components/SharedDrive/SharedDriveModal.jsx +1 -1
  61. package/src/components/SharedDrive/SharedDriveRecipientPermissions.jsx +15 -17
  62. package/src/components/SharedDrive/useSharedDrive.js +24 -50
  63. package/src/components/SharedDrive/useSharedDrive.spec.js +19 -67
  64. package/src/components/SharedFolder/DumbBatchSharedFolderModal.jsx +15 -29
  65. package/src/components/Sharetypeselect.jsx +75 -58
  66. package/src/hooks/usePendingRecipients.js +13 -0
  67. package/src/hooks/usePendingRecipients.spec.js +21 -0
  68. package/src/styles/autosuggest.styl +8 -2
  69. package/src/styles/share.styl +0 -39
  70. package/dist/components/Recipient/actions/revokeGroup.js +0 -42
  71. package/dist/components/Recipient/actions/revokeMember.js +0 -42
  72. package/dist/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
  73. package/dist/components/SharedDrive/helpers.js +0 -102
  74. package/dist/components/SharedDrive/helpers.spec.js +0 -227
  75. package/dist/components/Sharesubmit.js +0 -28
  76. package/src/components/Recipient/actions/revokeGroup.js +0 -42
  77. package/src/components/Recipient/actions/revokeMember.js +0 -42
  78. package/src/components/Recipient/actions/revokeSharedDriveMember.js +0 -41
  79. package/src/components/SharedDrive/helpers.js +0 -108
  80. package/src/components/SharedDrive/helpers.spec.js +0 -177
  81. package/src/components/Sharesubmit.jsx +0 -31
@@ -3,14 +3,15 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import PropTypes from 'prop-types';
4
4
  import React, { useState } from 'react';
5
5
  import Avatar from 'cozy-ui/transpiled/react/Avatar';
6
- import Button from 'cozy-ui/transpiled/react/Button';
7
6
  import Fade from 'cozy-ui/transpiled/react/Fade';
8
7
  import Icon from 'cozy-ui/transpiled/react/Icon';
8
+ import IconButton from 'cozy-ui/transpiled/react/IconButton';
9
9
  import Gear from 'cozy-ui/transpiled/react/Icons/Gear';
10
10
  import LinkIcon from 'cozy-ui/transpiled/react/Icons/Link';
11
11
  import ListItem from 'cozy-ui/transpiled/react/ListItem';
12
12
  import ListItemIcon from 'cozy-ui/transpiled/react/ListItemIcon';
13
13
  import ListItemText from 'cozy-ui/transpiled/react/ListItemText';
14
+ import Typography from 'cozy-ui/transpiled/react/Typography';
14
15
  import useBreakpoints from 'cozy-ui/transpiled/react/providers/Breakpoints';
15
16
  import { useI18n } from 'twake-i18n';
16
17
  import LinkRecipientPermissions from './LinkRecipientPermissions';
@@ -70,16 +71,19 @@ var LinkRecipient = function LinkRecipient(props) {
70
71
  }, /*#__PURE__*/React.createElement(Icon, {
71
72
  icon: LinkIcon
72
73
  }))), /*#__PURE__*/React.createElement(ListItemText, {
73
- primary: /*#__PURE__*/React.createElement(Button, {
74
- variant: "ghost",
75
- onClick: function onClick() {
76
- return setOpenShareRestrictionModal(true);
77
- },
78
- endIcon: /*#__PURE__*/React.createElement(Icon, {
79
- icon: Gear
80
- }),
81
- className: "u-p-0"
82
- }, textPrimary),
74
+ onClick: function onClick() {
75
+ return setOpenShareRestrictionModal(true);
76
+ },
77
+ primary: /*#__PURE__*/React.createElement("div", {
78
+ className: "u-flex u-flex-items-center"
79
+ }, /*#__PURE__*/React.createElement(Typography, {
80
+ className: "u-c-pointer "
81
+ }, textPrimary), /*#__PURE__*/React.createElement(IconButton, {
82
+ size: "small",
83
+ className: "u-ml-half"
84
+ }, /*#__PURE__*/React.createElement(Icon, {
85
+ icon: Gear
86
+ }))),
83
87
  secondary: textSecondary
84
88
  }), RightPart, openShareRestrictionModal && /*#__PURE__*/React.createElement(ShareRestrictionModal, {
85
89
  file: document,
@@ -36,7 +36,7 @@ var LinkRecipientLite = function LinkRecipientLite(_ref) {
36
36
  }), /*#__PURE__*/React.createElement(Typography, {
37
37
  className: "u-flex-shrink-0",
38
38
  variant: "body2"
39
- }, t("Share.type.".concat(isReadOnlyPermissions ? 'one-way' : 'two-way')).toLowerCase()));
39
+ }, t("Share.type.".concat(isReadOnlyPermissions ? 'one-way' : 'two-way'))));
40
40
  };
41
41
 
42
42
  LinkRecipientLite.propTypes = {
@@ -50,6 +50,7 @@ var LinkRecipientPermissions = function LinkRecipientPermissions(_ref) {
50
50
  updateDocumentPermissions(document, {
51
51
  verbs: verbs
52
52
  });
53
+ hideMenu();
53
54
  };
54
55
 
55
56
  var handleRevocation = function handleRevocation() {
@@ -77,7 +78,7 @@ var LinkRecipientPermissions = function LinkRecipientPermissions(_ref) {
77
78
  ref: buttonRef,
78
79
  textVariant: "body2",
79
80
  onClick: toggleMenu
80
- }, t("Share.type.".concat(type)).toLowerCase()), /*#__PURE__*/React.createElement(ActionsMenu, {
81
+ }, t("Share.type.".concat(type))), /*#__PURE__*/React.createElement(ActionsMenu, {
81
82
  ref: buttonRef,
82
83
  open: isMenuDisplayed,
83
84
  actions: actions,
@@ -70,7 +70,7 @@ describe('MemberRecipient component', function () {
70
70
  expect(getByText('foo.mycozy.cloud')).toBeTruthy();
71
71
  });
72
72
  it('should call revokeSelf if I am not the owner but try to revoke myself', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
73
- var onRevoke, onRevokeSelf, _setup3, getByText;
73
+ var onRevoke, onRevokeSelf, _setup3, getByLabelText;
74
74
 
75
75
  return _regeneratorRuntime.wrap(function _callee$(_context) {
76
76
  while (1) switch (_context.prev = _context.next) {
@@ -84,20 +84,19 @@ describe('MemberRecipient component', function () {
84
84
  documentType: 'Files',
85
85
  onRevoke: onRevoke,
86
86
  onRevokeSelf: onRevokeSelf
87
- }), getByText = _setup3.getByText;
88
- fireEvent.click(getByText('can change'));
89
- fireEvent.click(getByText('Remove me from sharing'));
87
+ }), getByLabelText = _setup3.getByLabelText;
88
+ fireEvent.click(getByLabelText('Remove from sharing'));
90
89
  expect(onRevoke).not.toHaveBeenCalled();
91
90
  expect(onRevokeSelf).toHaveBeenCalled();
92
91
 
93
- case 7:
92
+ case 6:
94
93
  case "end":
95
94
  return _context.stop();
96
95
  }
97
96
  }, _callee);
98
97
  })));
99
98
  it('should call revoke if I am the owner of the sharing', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
100
- var onRevoke, onRevokeSelf, _setup4, getByText;
99
+ var onRevoke, onRevokeSelf, _setup4, getByLabelText;
101
100
 
102
101
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
103
102
  while (1) switch (_context2.prev = _context2.next) {
@@ -112,13 +111,12 @@ describe('MemberRecipient component', function () {
112
111
  documentType: 'Files',
113
112
  onRevoke: onRevoke,
114
113
  onRevokeSelf: onRevokeSelf
115
- }), getByText = _setup4.getByText;
116
- fireEvent.click(getByText('can change'));
117
- fireEvent.click(getByText('Remove from sharing'));
114
+ }), getByLabelText = _setup4.getByLabelText;
115
+ fireEvent.click(getByLabelText('Remove from sharing'));
118
116
  expect(onRevoke).toHaveBeenCalled();
119
117
  expect(onRevokeSelf).not.toHaveBeenCalled();
120
118
 
121
- case 7:
119
+ case 6:
122
120
  case "end":
123
121
  return _context2.stop();
124
122
  }
@@ -47,7 +47,7 @@ var MemberRecipientLite = function MemberRecipientLite(_ref) {
47
47
  }), /*#__PURE__*/React.createElement(Typography, {
48
48
  className: "u-flex-shrink-0",
49
49
  variant: "body2"
50
- }, recipientOwner ? t("Share.status.".concat(recipient.status)).toLowerCase() : t("Share.type.".concat((_recipient$type = recipient.type) !== null && _recipient$type !== void 0 ? _recipient$type : 'one-way')).toLowerCase()));
50
+ }, recipientOwner ? t("Share.status.".concat(recipient.status)) : t("Share.type.".concat((_recipient$type = recipient.type) !== null && _recipient$type !== void 0 ? _recipient$type : 'one-way'))));
51
51
  };
52
52
 
53
53
  MemberRecipientLite.propTypes = {
@@ -5,13 +5,15 @@ import React, { useState, useRef, useCallback } from 'react';
5
5
  import { useClient } from 'cozy-client';
6
6
  import minilog from 'cozy-minilog';
7
7
  import ActionsMenu from 'cozy-ui/transpiled/react/ActionsMenu';
8
- import { makeActions, divider } from 'cozy-ui/transpiled/react/ActionsMenu/Actions';
8
+ import { makeActions } from 'cozy-ui/transpiled/react/ActionsMenu/Actions';
9
9
  import DropdownButton from 'cozy-ui/transpiled/react/DropdownButton';
10
+ import Icon from 'cozy-ui/transpiled/react/Icon';
11
+ import IconButton from 'cozy-ui/transpiled/react/IconButton';
12
+ import CrossCircleOutlineIcon from 'cozy-ui/transpiled/react/Icons/CrossCircleOutline';
10
13
  import Spinner from 'cozy-ui/transpiled/react/Spinner';
11
14
  import Typography from 'cozy-ui/transpiled/react/Typography';
12
15
  import { useAlert } from 'cozy-ui/transpiled/react/providers/Alert';
13
16
  import { useI18n } from 'twake-i18n';
14
- import { revokeMember } from './actions/revokeMember';
15
17
  import { setReadOnlySharedPermission } from './actions/setReadOnlySharedPermission';
16
18
  import { setReadWriteSharedPermission } from './actions/setReadWriteSharedPermission';
17
19
  import { useSharingContext } from '../../hooks/useSharingContext';
@@ -19,7 +21,6 @@ var log = minilog('MemberRecipientPermissions');
19
21
 
20
22
  var MemberRecipientPermissions = function MemberRecipientPermissions(_ref) {
21
23
  var isOwner = _ref.isOwner,
22
- isSharedDrive = _ref.isSharedDrive,
23
24
  status = _ref.status,
24
25
  instance = _ref.instance,
25
26
  type = _ref.type,
@@ -143,32 +144,35 @@ var MemberRecipientPermissions = function MemberRecipientPermissions(_ref) {
143
144
  return _ref3.apply(this, arguments);
144
145
  };
145
146
  }(), [hideMenu, memberIndex, sharingId, showAlert, t, type, updateSharingMemberType]);
146
- var actions = makeActions([setReadOnlySharedPermission, setReadWriteSharedPermission, divider, revokeMember], {
147
- client: client,
147
+ var actions = makeActions([setReadOnlySharedPermission, setReadWriteSharedPermission], {
148
148
  t: t,
149
149
  type: type !== null && type !== void 0 ? type : 'one-way',
150
- isOwner: isOwner,
151
- isSharedDrive: isSharedDrive,
152
- setType: setType,
153
- handleRevocation: handleRevocation
150
+ setType: setType
154
151
  });
155
152
  return /*#__PURE__*/React.createElement("div", {
156
153
  className: className
157
154
  }, revoking && /*#__PURE__*/React.createElement(Spinner, null), !shouldShowMenu && !revoking && /*#__PURE__*/React.createElement(Typography, {
158
155
  variant: "body2"
159
- }, t("Share.status.".concat(status)).toLowerCase()), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
156
+ }, t("Share.status.".concat(status))), shouldShowMenu && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DropdownButton, {
160
157
  ref: buttonRef,
161
158
  "aria-controls": "simple-menu",
162
159
  "aria-haspopup": "true",
163
160
  onClick: toggleMenu,
164
161
  textVariant: "body2"
165
- }, t("Share.type.".concat(type)).toLowerCase()), /*#__PURE__*/React.createElement(ActionsMenu, {
162
+ }, t("Share.type.".concat(type))), /*#__PURE__*/React.createElement(ActionsMenu, {
166
163
  ref: buttonRef,
167
164
  open: isMenuDisplayed,
168
165
  actions: actions,
169
166
  autoClose: true,
170
167
  onClose: hideMenu
171
- })));
168
+ }), /*#__PURE__*/React.createElement(IconButton, {
169
+ onClick: handleRevocation,
170
+ size: "small",
171
+ className: "u-ml-half",
172
+ "aria-label": t('Share.members.revoke')
173
+ }, /*#__PURE__*/React.createElement(Icon, {
174
+ icon: CrossCircleOutlineIcon
175
+ }))));
172
176
  };
173
177
 
174
178
  export default MemberRecipientPermissions;
@@ -1,7 +1,7 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
- import { render, fireEvent, screen, act, waitFor } from '@testing-library/react';
4
+ import { render, fireEvent, screen, waitFor } from '@testing-library/react';
5
5
  import React from 'react';
6
6
  import { createMockClient } from 'cozy-client';
7
7
  import MemberRecipientPermissions from './MemberRecipientPermissions';
@@ -81,10 +81,12 @@ describe('MemberRecipientPermissions component', function () {
81
81
  });
82
82
  it('should render the current permission type', function () {
83
83
  setup();
84
- expect(screen.getByText('can change')).toBeInTheDocument();
84
+ expect(screen.getByRole('button', {
85
+ name: 'Editor'
86
+ })).toBeInTheDocument();
85
87
  });
86
88
  it('should call updateSharingMemberType when changing to one-way', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
87
- var _setup, getByText;
89
+ var _setup, getByRole;
88
90
 
89
91
  return _regeneratorRuntime.wrap(function _callee$(_context) {
90
92
  while (1) switch (_context.prev = _context.next) {
@@ -92,9 +94,13 @@ describe('MemberRecipientPermissions component', function () {
92
94
  mockUpdateSharingMemberType.mockResolvedValue(undefined);
93
95
  _setup = setup({
94
96
  type: 'two-way'
95
- }), getByText = _setup.getByText;
96
- fireEvent.click(getByText('can change'));
97
- fireEvent.click(getByText('Can view'));
97
+ }), getByRole = _setup.getByRole;
98
+ fireEvent.click(getByRole('button', {
99
+ name: 'Editor'
100
+ }));
101
+ fireEvent.click(getByRole('menuitem', {
102
+ name: 'Viewer'
103
+ }));
98
104
  expect(mockUpdateSharingMemberType).toHaveBeenCalledWith('sharing-123', 1, 'one-way');
99
105
 
100
106
  case 5:
@@ -104,7 +110,7 @@ describe('MemberRecipientPermissions component', function () {
104
110
  }, _callee);
105
111
  })));
106
112
  it('should call updateSharingMemberType when changing to two-way', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
107
- var _setup2, getByText;
113
+ var _setup2, getByRole;
108
114
 
109
115
  return _regeneratorRuntime.wrap(function _callee2$(_context2) {
110
116
  while (1) switch (_context2.prev = _context2.next) {
@@ -112,9 +118,13 @@ describe('MemberRecipientPermissions component', function () {
112
118
  mockUpdateSharingMemberType.mockResolvedValue(undefined);
113
119
  _setup2 = setup({
114
120
  type: 'one-way'
115
- }), getByText = _setup2.getByText;
116
- fireEvent.click(getByText('can view'));
117
- fireEvent.click(getByText('Can change'));
121
+ }), getByRole = _setup2.getByRole;
122
+ fireEvent.click(getByRole('button', {
123
+ name: 'Viewer'
124
+ }));
125
+ fireEvent.click(getByRole('menuitem', {
126
+ name: 'Editor'
127
+ }));
118
128
  expect(mockUpdateSharingMemberType).toHaveBeenCalledWith('sharing-123', 1, 'two-way');
119
129
 
120
130
  case 5:
@@ -123,33 +133,23 @@ describe('MemberRecipientPermissions component', function () {
123
133
  }
124
134
  }, _callee2);
125
135
  })));
126
- it('should show error alert when updateSharingMemberType fails', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
127
- var _setup3, getByText;
136
+ it('should show error alert when updateSharingMemberType fails', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
137
+ var _setup3, getByRole;
128
138
 
129
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
130
- while (1) switch (_context4.prev = _context4.next) {
139
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
140
+ while (1) switch (_context3.prev = _context3.next) {
131
141
  case 0:
132
142
  mockUpdateSharingMemberType.mockRejectedValue(new Error('Network error'));
133
143
  _setup3 = setup({
134
144
  type: 'two-way'
135
- }), getByText = _setup3.getByText;
136
- _context4.next = 4;
137
- return act( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
138
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
139
- while (1) switch (_context3.prev = _context3.next) {
140
- case 0:
141
- fireEvent.click(getByText('can change'));
142
- fireEvent.click(getByText('Can view'));
143
-
144
- case 2:
145
- case "end":
146
- return _context3.stop();
147
- }
148
- }, _callee3);
149
- })));
150
-
151
- case 4:
152
- _context4.next = 6;
145
+ }), getByRole = _setup3.getByRole;
146
+ fireEvent.click(getByRole('button', {
147
+ name: 'Editor'
148
+ }));
149
+ fireEvent.click(getByRole('menuitem', {
150
+ name: 'Viewer'
151
+ }));
152
+ _context3.next = 6;
153
153
  return waitFor(function () {
154
154
  expect(mockShowAlert).toHaveBeenCalledWith({
155
155
  message: 'An error occurred while changing the permissions. Please try again.',
@@ -160,55 +160,67 @@ describe('MemberRecipientPermissions component', function () {
160
160
 
161
161
  case 6:
162
162
  case "end":
163
- return _context4.stop();
163
+ return _context3.stop();
164
164
  }
165
- }, _callee4);
165
+ }, _callee3);
166
166
  })));
167
- it('should not call updateSharingMemberType when selecting same type', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
168
- var _setup4, getByText;
167
+ it('should not call updateSharingMemberType when selecting same type', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
168
+ var _setup4, getByRole;
169
169
 
170
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
171
- while (1) switch (_context5.prev = _context5.next) {
170
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
171
+ while (1) switch (_context4.prev = _context4.next) {
172
172
  case 0:
173
173
  mockUpdateSharingMemberType.mockResolvedValue(undefined);
174
174
  _setup4 = setup({
175
175
  type: 'two-way'
176
- }), getByText = _setup4.getByText;
177
- fireEvent.click(getByText('can change'));
178
- fireEvent.click(getByText('Can change'));
176
+ }), getByRole = _setup4.getByRole;
177
+ fireEvent.click(getByRole('button', {
178
+ name: 'Editor'
179
+ }));
180
+ fireEvent.click(getByRole('menuitem', {
181
+ name: 'Editor'
182
+ }));
179
183
  expect(mockUpdateSharingMemberType).not.toHaveBeenCalled();
180
184
 
181
185
  case 5:
182
186
  case "end":
183
- return _context5.stop();
187
+ return _context4.stop();
184
188
  }
185
- }, _callee5);
189
+ }, _callee4);
186
190
  })));
187
191
  it('should not render menu when user is not owner and not the shared drive contact', function () {
188
192
  var _setup5 = setup({
189
193
  isOwner: false,
190
194
  instance: 'http://other-cozy.local:8080'
191
195
  }),
192
- queryByText = _setup5.queryByText;
196
+ queryByRole = _setup5.queryByRole;
193
197
 
194
- expect(queryByText('can change')).not.toBeInTheDocument();
195
- expect(queryByText('can view')).not.toBeInTheDocument();
198
+ expect(queryByRole('button', {
199
+ name: 'Editor'
200
+ })).not.toBeInTheDocument();
201
+ expect(queryByRole('button', {
202
+ name: 'Viewer'
203
+ })).not.toBeInTheDocument();
196
204
  });
197
205
  it('should render menu for owner', function () {
198
206
  var _setup6 = setup({
199
207
  isOwner: true
200
208
  }),
201
- getByText = _setup6.getByText;
209
+ getByRole = _setup6.getByRole;
202
210
 
203
- expect(getByText('can change')).toBeInTheDocument();
211
+ expect(getByRole('button', {
212
+ name: 'Editor'
213
+ })).toBeInTheDocument();
204
214
  });
205
215
  it('should render menu for the user themselves', function () {
206
216
  var _setup7 = setup({
207
217
  isOwner: false,
208
218
  instance: 'http://cozy.local:8080'
209
219
  }),
210
- getByText = _setup7.getByText;
220
+ getByRole = _setup7.getByRole;
211
221
 
212
- expect(getByText('can change')).toBeInTheDocument();
222
+ expect(getByRole('button', {
223
+ name: 'Editor'
224
+ })).toBeInTheDocument();
213
225
  });
214
226
  });
@@ -16,11 +16,6 @@ var modalStyles = {
16
16
  "error": "share__error___pwqPO",
17
17
  "share-byemail-onlybylink": "share__share-byemail-onlybylink___29W-t",
18
18
  "aligned-dropdown-button": "share__aligned-dropdown-button___3crgG",
19
- "share-type-control": "share__share-type-control___1YoRr",
20
- "select-wrapper": "share__select-wrapper___3XBKC",
21
- "select-option": "share__select-option___3Jp8_",
22
- "select-option-label": "share__select-option-label___1BWz_",
23
- "select-option-desc": "share__select-option-desc___3jOnr",
24
19
  "share-details-created": "share__share-details-created___z3nvO",
25
20
  "share-details-perm": "share__share-details-perm___3HjxK",
26
21
  "share-details-perm-desc": "share__share-details-perm-desc___3HyHu"
@@ -19,7 +19,8 @@ var styles = {
19
19
  "suggestionHighlighted": "autosuggest__suggestionHighlighted___1vpXJ",
20
20
  "suggestionInput": "autosuggest__suggestionInput___3SK9w",
21
21
  "recipientsContainer": "autosuggest__recipientsContainer___1JYxA",
22
- "recipientChip": "autosuggest__recipientChip___d5I3R"
22
+ "recipientChip": "autosuggest__recipientChip___d5I3R",
23
+ "endAdornment": "autosuggest__endAdornment___2EwTN"
23
24
  };
24
25
  import { cozyUrlMatch, emailMatch, groupNameMatch, fullnameMatch } from '../suggestionMatchers';
25
26
 
@@ -30,7 +31,8 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
30
31
  recipients = _ref.recipients,
31
32
  onPick = _ref.onPick,
32
33
  onRemove = _ref.onRemove,
33
- placeholder = _ref.placeholder;
34
+ placeholder = _ref.placeholder,
35
+ endAdornment = _ref.endAdornment;
34
36
 
35
37
  var _useState = useState(''),
36
38
  _useState2 = _slicedToArray(_useState, 2),
@@ -191,7 +193,9 @@ var ShareAutocomplete = function ShareAutocomplete(_ref) {
191
193
  onKeyUp: onKeyUp
192
194
  })), loading && isLoadingDisplayed ? /*#__PURE__*/React.createElement(Spinner, {
193
195
  color: "var(--primaryColor)"
194
- }) : null);
196
+ }) : null, endAdornment ? /*#__PURE__*/React.createElement("div", {
197
+ className: styles['endAdornment']
198
+ }, endAdornment) : null);
195
199
  };
196
200
 
197
201
  var renderSuggestion = function renderSuggestion(contactOrGroup) {
@@ -236,6 +240,7 @@ ShareAutocomplete.propTypes = {
236
240
  recipients: PropTypes.array.isRequired,
237
241
  onPick: PropTypes.func.isRequired,
238
242
  onRemove: PropTypes.func.isRequired,
239
- placeholder: PropTypes.string
243
+ placeholder: PropTypes.string,
244
+ endAdornment: PropTypes.node
240
245
  };
241
246
  export default ShareAutocomplete;