feat(av-moderation) id and aria-label updates for av-moderation test (#9592)

* feat(av-moderation) raised hand ask to unmute aria-label

* feat(av-moderation) fixed test

* feat(av-moderation) added id for notification buttons

* feat(av-moderation) fixed lint error

* feat(av-moderation) added id for non raised hand participant

* feat(av-moderation) added extra id naming for ask to unmute button and participant items

* feat(av-moderation) fixed lint errors

* feat(av-moderation) changed id to participantID

* feat(av-moderation) removed semicolon

* squash: Drop unused id for participantItem.

* squash: Drop unused fields for raisedHand.

Co-authored-by: Дамян Минков <damencho@jitsi.org>
This commit is contained in:
Calinteodor 2021-08-15 08:27:18 +03:00 committed by GitHub
parent 8c82c0f56e
commit e40d4a48b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 12 deletions

View File

@ -21,14 +21,19 @@ type Props = {
className: string, className: string,
/** /**
* The `data-testid` used for the button. * CSS id of the button.
*/ */
testId: string, id?: string,
/** /**
* The participant. * The participant.
*/ */
participant: Object participant: Object,
/**
* The `data-testid` used for the button.
*/
testId: string
} }
/** /**
@ -36,7 +41,7 @@ type Props = {
* *
* @returns {React$Element<'button'>} * @returns {React$Element<'button'>}
*/ */
export default function({ action, children, className, testId, participant }: Props) { export default function({ action, children, className, participant, id, testId }: Props) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const onClick = useCallback(() => dispatch(action(participant.id)), [ dispatch, participant ]); const onClick = useCallback(() => dispatch(action(participant.id)), [ dispatch, participant ]);
@ -44,6 +49,7 @@ export default function({ action, children, className, testId, participant }: Pr
<button <button
className = { className } className = { className }
data-testid = { testId } data-testid = { testId }
id = { id }
onClick = { onClick } onClick = { onClick }
type = 'button'> type = 'button'>
{ children } { children }

View File

@ -80,6 +80,7 @@ export default function({
{ <NotificationButton { <NotificationButton
action = { onApprove } action = { onApprove }
className = 'primary' className = 'primary'
id = 'unmute-button'
participant = { p } participant = { p }
testId = { `${testIdPrefix}.allow` }> testId = { `${testIdPrefix}.allow` }>
{ approveButtonText } { approveButtonText }
@ -87,6 +88,7 @@ export default function({
{ <NotificationButton { <NotificationButton
action = { onReject } action = { onReject }
className = 'borderLess' className = 'borderLess'
id = 'dismiss-button'
participant = { p } participant = { p }
testId = { `${testIdPrefix}.reject` }> testId = { `${testIdPrefix}.reject` }>
{ rejectButtonText } { rejectButtonText }

View File

@ -15,9 +15,9 @@ type Props = {
askUnmuteText: string, askUnmuteText: string,
/** /**
* Participant id. * Participant participantID.
*/ */
id: string participantID: string,
} }
/** /**
@ -26,14 +26,15 @@ type Props = {
* @param {Object} participant - Participant reference. * @param {Object} participant - Participant reference.
* @returns {React$Element<'button'>} * @returns {React$Element<'button'>}
*/ */
export default function AskToUnmuteButton({ id, askUnmuteText }: Props) { export default function AskToUnmuteButton({ askUnmuteText, participantID }: Props) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const askToUnmute = useCallback(() => { const askToUnmute = useCallback(() => {
dispatch(approveParticipant(id)); dispatch(approveParticipant(participantID));
}, [ dispatch, id ]); }, [ dispatch, participantID ]);
return ( return (
<QuickActionButton <QuickActionButton
aria-label = { `unmute-${participantID}` }
onClick = { askToUnmute } onClick = { askToUnmute }
primary = { true } primary = { true }
theme = {{ theme = {{

View File

@ -90,7 +90,7 @@ export const FooterContextMenu = ({ onMouseLeave }: Props) => {
</div> </div>
{ isModerationEnabled ? ( { isModerationEnabled ? (
<ContextMenuItem <ContextMenuItem
id = 'participants-pane-context-menu-start-moderation' id = 'participants-pane-context-menu-stop-moderation'
onClick = { disable }> onClick = { disable }>
<span className = { classes.paddedAction }> <span className = { classes.paddedAction }>
{ t('participantsPane.actions.startModeration') } { t('participantsPane.actions.startModeration') }
@ -98,7 +98,7 @@ export const FooterContextMenu = ({ onMouseLeave }: Props) => {
</ContextMenuItem> </ContextMenuItem>
) : ( ) : (
<ContextMenuItem <ContextMenuItem
id = 'participants-pane-context-menu-stop-moderation' id = 'participants-pane-context-menu-start-moderation'
onClick = { enable }> onClick = { enable }>
<Icon <Icon
size = { 20 } size = { 20 }

View File

@ -9,6 +9,11 @@ import { QuickActionButton } from './web/styled';
type Props = { type Props = {
/**
* The translated ask unmute aria label.
*/
ariaLabel?: boolean,
/** /**
* The translated "ask unmute" text. * The translated "ask unmute" text.
*/ */
@ -24,6 +29,9 @@ type Props = {
*/ */
muteAudio: Function, muteAudio: Function,
/**
* Label for mute participant button.
*/
muteParticipantButtonText: string, muteParticipantButtonText: string,
/** /**
@ -59,7 +67,7 @@ export default function ParticipantQuickAction({
return ( return (
<AskToUnmuteButton <AskToUnmuteButton
askUnmuteText = { askUnmuteText } askUnmuteText = { askUnmuteText }
id = { participantID } /> participantID = { participantID } />
); );
} }
default: { default: {

View File

@ -161,6 +161,7 @@ export default function ParticipantItem({
return ( return (
<ParticipantContainer <ParticipantContainer
id = { `participant-item-${participantID}` }
isHighlighted = { isHighlighted } isHighlighted = { isHighlighted }
onMouseLeave = { onLeave } onMouseLeave = { onLeave }
trigger = { actionsTrigger }> trigger = { actionsTrigger }>