Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Resaki1 committed Jan 15, 2025
1 parent 29d4e70 commit a2f1f65
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -570,8 +570,10 @@ exports[`Column should have correct style show column with correct style 1`] = `
role="none"
>
<button
aria-label="Remove vote"
class="dot-button vote-button-remove"
title="Remove vote"
data-tooltip-content="Remove vote"
data-tooltip-id="scrumlr-tooltip"
>
<span
class="vote-button-remove__folded-corner"
Expand All @@ -588,9 +590,11 @@ exports[`Column should have correct style show column with correct style 1`] = `
</span>
</button>
<button
aria-label="Multiple votes are not allowed"
class="dot-button vote-button-add"
data-tooltip-content="Multiple votes are not allowed"
data-tooltip-id="scrumlr-tooltip"
disabled=""
title="Add vote"
>
<svg
class="vote-button-add__icon"
Expand Down Expand Up @@ -1151,8 +1155,10 @@ exports[`Column should have correct style show column with correct style 1`] = `
role="none"
>
<button
aria-label="Add vote"
class="dot-button vote-button-add"
title="Add vote"
data-tooltip-content="Add vote"
data-tooltip-id="scrumlr-tooltip"
>
<svg
class="vote-button-add__icon"
Expand Down
3 changes: 1 addition & 2 deletions src/components/DotButton/DotButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ type DotButtonProps = {
className?: string;
disabled?: boolean;
onClick?: () => void;
title?: string;
onAnimationEnd?: () => void;
dataTooltipId?: string;
dataTooltipContent?: string;
Expand All @@ -20,7 +19,7 @@ export const DotButton: FC<PropsWithChildren<DotButtonProps>> = (props) => (
e.stopPropagation();
props.onClick?.();
}}
title={props.title}
aria-label={props.dataTooltipContent}
onAnimationEnd={props.onAnimationEnd}
data-tooltip-id={props.dataTooltipId}
data-tooltip-content={props.dataTooltipContent}
Expand Down
16 changes: 10 additions & 6 deletions src/components/Votes/__tests__/Votes.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ describe("Votes", () => {

expect(screen.queryByTitle(i18n.t("Votes.AddVote"))).not.toBeInTheDocument();
expect(screen.queryByTitle(i18n.t("Votes.RemoveVote"))).not.toBeInTheDocument();
expect(screen.queryByTitle(i18n.t("Votes.VotesOnNote", {votes: 1}))).toBeInTheDocument();
expect(screen.queryByTitle(i18n.t("Votes.VotesOnNote", {votes: 1}))).toBeDisabled();
expect(screen.queryByLabelText(i18n.t("Votes.VotesOnNote", {count: 1}))).toBeInTheDocument();
expect(screen.queryByLabelText(i18n.t("Votes.VotesOnNote", {count: 1}))).toBeDisabled();
});

it("add vote button should be visible and remove vote button not disabled on locked board if participant is moderator", () => {
Expand All @@ -115,12 +115,16 @@ describe("Votes", () => {
others: [],
focusInitiator: undefined,
},
votings: {
open: getTestVoting({allowMultipleVotes: true}),
past: [],
},
})
);

expect(screen.getByTitle(i18n.t("Votes.AddVote"))).toBeInTheDocument();
expect(screen.queryByTitle(i18n.t("Votes.RemoveVote"))).toBeInTheDocument();
expect(screen.queryByTitle(i18n.t("Votes.RemoveVote"))).not.toBeDisabled();
expect(screen.queryByTitle(i18n.t("Votes.VotesOnNote", {votes: 1}))).not.toBeInTheDocument();
expect(screen.getByLabelText(i18n.t("Votes.AddVote"))).toBeInTheDocument();
expect(screen.getByLabelText(i18n.t("Votes.RemoveVote"))).toBeInTheDocument();
expect(screen.getByLabelText(i18n.t("Votes.RemoveVote"))).not.toBeDisabled();
expect(screen.queryByLabelText(i18n.t("Votes.VotesOnNote", {count: 1}))).not.toBeInTheDocument();
});
});
16 changes: 12 additions & 4 deletions src/components/Votes/__tests__/__snapshots__/Votes.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ exports[`Votes should render correctly with no votes and active voting 1`] = `
role="none"
>
<button
aria-label="Add vote"
class="dot-button vote-button-add"
title="Add vote"
data-tooltip-content="Add vote"
data-tooltip-id="scrumlr-tooltip"
>
<svg
class="vote-button-add__icon"
Expand All @@ -29,8 +31,10 @@ exports[`Votes should render correctly with votes and active voting 1`] = `
role="none"
>
<button
aria-label="Remove vote"
class="dot-button vote-button-remove"
title="Remove vote"
data-tooltip-content="Remove vote"
data-tooltip-id="scrumlr-tooltip"
>
<span
class="vote-button-remove__folded-corner"
Expand All @@ -47,9 +51,11 @@ exports[`Votes should render correctly with votes and active voting 1`] = `
</span>
</button>
<button
aria-label="Multiple votes are not allowed"
class="dot-button vote-button-add"
data-tooltip-content="Multiple votes are not allowed"
data-tooltip-id="scrumlr-tooltip"
disabled=""
title="Add vote"
>
<svg
class="vote-button-add__icon"
Expand All @@ -68,9 +74,11 @@ exports[`Votes should render correctly with votes and disabled voting 1`] = `
role="none"
>
<button
aria-label="1 vote"
class="dot-button vote-button-remove"
data-tooltip-content="1 vote"
data-tooltip-id="scrumlr-tooltip"
disabled=""
title="1 vote(s)"
>
<span
class="vote-button-remove__folded-corner"
Expand Down

0 comments on commit a2f1f65

Please sign in to comment.