@@ -968,6 +968,35 @@ const Editor = (props: EditorProps): JSX.Element => {
968
968
editor ?. focus ( ) ;
969
969
if ( isProjectStep ( ) && editor ) {
970
970
showEditableRegion ( editor ) ;
971
+
972
+ // resetting test output
973
+ // TODO: DRY this - createOutputNode doesn't also need to set this up.
974
+ const testButton = document . getElementById ( 'test-button' ) ;
975
+ if ( testButton ) {
976
+ testButton . innerHTML = 'Check Your Code (Ctrl + Enter)' ;
977
+ testButton . onclick = ( ) => {
978
+ props . executeChallenge ( ) ;
979
+ } ;
980
+ }
981
+ const testStatus = document . getElementById ( 'test-status' ) ;
982
+ if ( testStatus ) {
983
+ testStatus . innerHTML = '' ;
984
+ }
985
+ const testOutput = document . getElementById ( 'test-output' ) ;
986
+ if ( testOutput ) {
987
+ testOutput . innerHTML = '' ;
988
+ }
989
+ // resetting margin decorations
990
+ // TODO: this should be done via the decorator api, not by manipulating
991
+ // the DOM
992
+ const editableRegionDecorators = document . getElementsByClassName (
993
+ 'myEditableLineDecoration'
994
+ ) ;
995
+ if ( editableRegionDecorators . length > 0 ) {
996
+ for ( const i of editableRegionDecorators ) {
997
+ i . classList . remove ( 'tests-passed' ) ;
998
+ }
999
+ }
971
1000
}
972
1001
// eslint-disable-next-line react-hooks/exhaustive-deps
973
1002
} , [ props . challengeFiles ] ) ;
@@ -990,6 +1019,8 @@ const Editor = (props: EditorProps): JSX.Element => {
990
1019
} ;
991
1020
}
992
1021
1022
+ // TODO: this should be done via the decorator api, not by manipulating
1023
+ // the DOM
993
1024
const editableRegionDecorators = document . getElementsByClassName (
994
1025
'myEditableLineDecoration'
995
1026
) ;
0 commit comments