Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/matrix-widget-toolki…
Browse files Browse the repository at this point in the history
…t/testing-2.3.1
  • Loading branch information
maheichyk authored Sep 8, 2023
2 parents edaefb6 + cc62f4d commit 0131037
Show file tree
Hide file tree
Showing 146 changed files with 1,268 additions and 1,259 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"jest": "^27.4.3",
"jest-axe": "^7.0.0",
"lint-staged": "^13.1.2",
"prettier": "^2.8.4",
"prettier": "^3.0.0",
"prettier-plugin-organize-imports": "^3.2.2",
"react-scripts": "5.0.1",
"sass": "^1.57.1",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { StoreProvider } from './store';
function App() {
const { showNotification } = useNotifications();
const [pollNotificationsMiddleware] = useState(() =>
createPollStatusNotificationsMiddleware({ showNotification })
createPollStatusNotificationsMiddleware({ showNotification }),
);

return (
Expand Down
36 changes: 18 additions & 18 deletions src/components/Admin/AdminPanel/AdminPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ describe('<AdminPanel/>', () => {
membership: 'join',
avatar_url: undefined,
},
})
}),
);

widgetApi.mockSendStateEvent(
Expand All @@ -62,7 +62,7 @@ describe('<AdminPanel/>', () => {
'user-bob': { memberRole: 'representative' },
},
},
})
}),
);

Wrapper = ({ children }: PropsWithChildren<{}>) => {
Expand All @@ -81,7 +81,7 @@ describe('<AdminPanel/>', () => {
const { container } = render(<AdminPanel />, { wrapper: Wrapper });

await expect(
screen.findByRole('list', { name: /groups/i })
screen.findByRole('list', { name: /groups/i }),
).resolves.toBeInTheDocument();

expect(await axe(container)).toHaveNoViolations();
Expand All @@ -96,20 +96,20 @@ describe('<AdminPanel/>', () => {
});

expect(
within(item).getByRole('heading', { name: /group 0/i, level: 4 })
within(item).getByRole('heading', { name: /group 0/i, level: 4 }),
).toBeInTheDocument();

await expect(
within(item).findByRole('button', {
name: /more settings/i,
description: 'GROUP 0',
})
}),
).resolves.toBeInTheDocument();

const nav = screen.getByRole('navigation');

expect(
within(nav).getByRole('button', { name: /create new group/i })
within(nav).getByRole('button', { name: /create new group/i }),
).toBeInTheDocument();
});

Expand All @@ -123,7 +123,7 @@ describe('<AdminPanel/>', () => {
expect(
within(list).getByRole('listitem', {
name: /you have to create a group first/i,
})
}),
).toBeInTheDocument();
});

Expand All @@ -132,7 +132,7 @@ describe('<AdminPanel/>', () => {
widgetApi.mockSendStateEvent(
mockPowerLevelsEvent({
content: { users_default: 0 },
})
}),
);

render(<AdminPanel />, { wrapper: Wrapper });
Expand All @@ -142,7 +142,7 @@ describe('<AdminPanel/>', () => {
expect(
within(list).getByRole('listitem', {
name: /an admin has to create a group first/i,
})
}),
).toBeInTheDocument();
});

Expand All @@ -155,21 +155,21 @@ describe('<AdminPanel/>', () => {
});

await userEvent.click(
await within(item).findByRole('button', { name: /more settings/i })
await within(item).findByRole('button', { name: /more settings/i }),
);

const menu = screen.getByRole('menu', { name: /more settings/i });

await userEvent.click(
within(menu).getByRole('menuitem', { name: /delete group/i })
within(menu).getByRole('menuitem', { name: /delete group/i }),
);

const deleteModal = screen.getByRole('dialog', {
name: /delete group/i,
});

await userEvent.click(
within(deleteModal).getByRole('button', { name: 'Delete' })
within(deleteModal).getByRole('button', { name: 'Delete' }),
);

await waitFor(() => {
Expand All @@ -185,7 +185,7 @@ describe('<AdminPanel/>', () => {
const nav = await screen.findByRole('navigation');

await userEvent.click(
within(nav).getByRole('button', { name: /create new group/i })
within(nav).getByRole('button', { name: /create new group/i }),
);

expect(widgetApi.openModal).toBeCalledWith(
Expand All @@ -205,7 +205,7 @@ describe('<AdminPanel/>', () => {
label: 'Cancel',
},
],
}
},
);

expect(widgetApi.sendStateEvent).not.toBeCalled();
Expand All @@ -221,7 +221,7 @@ describe('<AdminPanel/>', () => {
const nav = await screen.findByRole('navigation');

await userEvent.click(
within(nav).getByRole('button', { name: /create new group/i })
within(nav).getByRole('button', { name: /create new group/i }),
);

expect(widgetApi.openModal).toBeCalledWith(
Expand All @@ -241,14 +241,14 @@ describe('<AdminPanel/>', () => {
label: 'Cancel',
},
],
}
},
);

await waitFor(() => {
expect(widgetApi.sendStateEvent).toBeCalledWith(
'net.nordeck.poll.group',
{ abbreviation: 'GROUP 0', color: '#07f556', members: {} },
{ stateKey: expect.any(String) }
{ stateKey: expect.any(String) },
);
});
});
Expand All @@ -257,7 +257,7 @@ describe('<AdminPanel/>', () => {
widgetApi.mockSendStateEvent(
mockPowerLevelsEvent({
content: { users_default: 0 },
})
}),
);

render(<AdminPanel />, { wrapper: Wrapper });
Expand Down
6 changes: 3 additions & 3 deletions src/components/Admin/AdminPanel/AdminPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function AdminPanel(): ReactElement {
label: t('adminPanel.createGroupModal.cancel', 'Cancel'),
},
],
}
},
);

if (data) {
Expand Down Expand Up @@ -112,11 +112,11 @@ export function AdminPanel(): ReactElement {
canCreateGroups
? t(
'adminPanel.noGroupsAdminMessage',
'You have to create a group first.'
'You have to create a group first.',
)
: t(
'adminPanel.noGroupsUserMessage',
'An admin has to create a group first.'
'An admin has to create a group first.',
)
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,27 @@ export function AssignParticipantButton({
const handleGetOptionLabel = useCallback(
(event: StateEvent<RoomMemberStateEventContent>) =>
getUserDisplayName(event.state_key),
[getUserDisplayName]
[getUserDisplayName],
);

const handleOnChange = useCallback(
async (
_: SyntheticEvent,
event: StateEvent<RoomMemberStateEventContent> | null
event: StateEvent<RoomMemberStateEventContent> | null,
) => {
setInputValue('');

if (event) {
onAdd(event.state_key);
}
},
[onAdd]
[onAdd],
);
const handleOnInputChange = useCallback(
(_: SyntheticEvent, value: string) => {
setInputValue(value);
},
[]
[],
);

const handleRenderInput = useCallback(
Expand All @@ -95,13 +95,13 @@ export function AssignParticipantButton({
/>
);
},
[label]
[label],
);

const handleRenderOption = useCallback(
(
props: HTMLAttributes<HTMLLIElement>,
event: StateEvent<RoomMemberStateEventContent>
event: StateEvent<RoomMemberStateEventContent>,
): ReactNode => {
return (
<UserListItem
Expand All @@ -111,7 +111,7 @@ export function AssignParticipantButton({
/>
);
},
[]
[],
);

return (
Expand All @@ -122,7 +122,7 @@ export function AssignParticipantButton({
inputValue={inputValue}
noOptionsText={t(
'assignParticipantsView.selectNoParticipants',
'There are no unassigned participants in this room.'
'There are no unassigned participants in this room.',
)}
onChange={handleOnChange}
onInputChange={handleOnInputChange}
Expand Down
14 changes: 7 additions & 7 deletions src/components/Admin/CreateGroupModal/CreateGroupModal.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('<CreateGroupModal>', () => {
state_key: 'user-bob',
event_id: 'event-id-1',
content: { displayname: 'Bob', avatar_url: undefined },
})
}),
);

Wrapper = ({ children }: PropsWithChildren<{}>) => {
Expand All @@ -69,20 +69,20 @@ describe('<CreateGroupModal>', () => {

await userEvent.type(
screen.getByRole('textbox', { name: /group title/i }),
'My Group'
'My Group',
);

await userEvent.click(
screen.getByRole('combobox', {
expanded: false,
name: /Assign delegate/i,
})
}),
);
await userEvent.click(await screen.findByRole('option', { name: /bob/i }));

expect(widgetApi.setModalButtonEnabled).toHaveBeenLastCalledWith(
'net.nordeck.create.group.submit',
true
true,
);

subject.next('net.nordeck.create.group.submit');
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('<CreateGroupModal>', () => {

expect(widgetApi.setModalButtonEnabled).toHaveBeenLastCalledWith(
'net.nordeck.create.group.submit',
false
false,
);

const textBox = screen.getByRole('textbox', { name: /group title/i });
Expand All @@ -119,14 +119,14 @@ describe('<CreateGroupModal>', () => {

expect(widgetApi.setModalButtonEnabled).toHaveBeenLastCalledWith(
'net.nordeck.create.group.submit',
true
true,
);

await userEvent.clear(textBox);

expect(widgetApi.setModalButtonEnabled).toHaveBeenLastCalledWith(
'net.nordeck.create.group.submit',
false
false,
);
});

Expand Down
Loading

0 comments on commit 0131037

Please sign in to comment.