Skip to content

Commit d5a50ef

Browse files
committed
f
1 parent 5ea326d commit d5a50ef

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

webapp/src/RoleSheet.spec.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,16 @@ describe('RoleSheet', () => {
2525
roles["Observing"].todos.forEach(todo => expect(screen.getByText(todo)).toBeInTheDocument())
2626
});
2727

28+
29+
it(`shows Other Roles todos when in Observing position`, () => {
30+
const roger = new Player("Roger");
31+
roger.scoreTimes("Typing", 3);
32+
roger.selectRole("Sponsor");
33+
render(<RoleSheet role="Sponsor" position="Observing" player={roger} scorePoints={() => { }} />);
34+
35+
roles["Sponsor"].todos.forEach(todo => expect(screen.getByText(todo)).toBeInTheDocument())
36+
});
37+
2838
it(`scores a single point using the checkboxes when submitting`, async () => {
2939
const mockScorePoints = jest.fn();
3040
render(<RoleSheet role="Typing" position="Typing" player={new Player("Roger")} scorePoints={mockScorePoints} />);

webapp/src/RoleSheet.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export function RoleSheet({
3030
}
3131
}
3232

33+
const canEarnPoints = role === position || position === "Observing" && role !== "Talking" && role != "Typing";
3334
return <div className="role">
3435
<hr />
3536
<label className="role-label">
@@ -45,7 +46,7 @@ export function RoleSheet({
4546
<EarnPointsForRole role={role} scorePoints={scorePoints} />
4647

4748
<form onSubmit={onSubmitCheckboxes}>
48-
{role === position && (
49+
{canEarnPoints && (
4950
<>
5051
{roles[role]?.todos?.map((todo, index) => (
5152
<TodoItem

0 commit comments

Comments
 (0)