Skip to content

Commit 0a05c3b

Browse files
committed
f
1 parent b1ee713 commit 0a05c3b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

webapp/src/RoleSheet.spec.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ describe('RoleSheet', () => {
5757
expect(mockScorePoints).toHaveBeenCalledWith("Talking", 2);
5858
})
5959

60+
it(`after scoring points todo checkboxes are reset`, async () => {
61+
render(<RoleSheet role="Talking" position="Talking" player={new Player("Roger")} scorePoints={jest.fn()} />);
62+
await checkTodo('Talking-0');
63+
await checkTodo('Talking-1');
64+
65+
await clickEarnPoints();
66+
67+
expectUnchecked('Talking-0');
68+
expectUnchecked('Talking-1');
69+
})
70+
6071
it(`earn button stays when no todos are marked`, async () => {
6172
const mockScorePoints = jest.fn();
6273
render(<RoleSheet role="Typing" position="Typing" player={new Player("Roger")} scorePoints={mockScorePoints} />);
@@ -101,6 +112,11 @@ async function clickEarnPoints() {
101112
});
102113
}
103114

115+
function expectUnchecked(todoId) {
116+
const checkbox = document.getElementById(todoId) as HTMLInputElement;
117+
expect(checkbox.checked).toBe(false);
118+
}
119+
104120
// TODO if canEarnPoints for role, show skills of role
105121
// cannot rotate until players have filled the form
106122
// TODO use it.each ??? but maybe its too clever?

webapp/src/RoleSheet.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export function RoleSheet({
2626
if(amount > 0) {
2727
scorePoints(role, amount);
2828
setPointsScored(true);
29+
checkboxes.forEach(checkbox => checkbox.checked = false);
2930
}
3031
}
3132

0 commit comments

Comments
 (0)