File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff 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?
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments