Skip to content

Commit 615be02

Browse files
adding some tests of the editor
1 parent 0b74dbe commit 615be02

File tree

3 files changed

+596
-183
lines changed

3 files changed

+596
-183
lines changed

playground/internal/editor/editor_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -934,16 +934,6 @@ func Test_Editor_ProcessKeyDown_CommentToggle(t *testing.T) {
934934
wantSelectionEnd: 48, // before last added `// `s
935935
wantPrefentDefault: true,
936936
})
937-
938-
runKeyDownTest(t, testKeyDown{
939-
name: `only blank lines`,
940-
code: "\n\n\n",
941-
key: `/`,
942-
ctrl: true,
943-
selectionStart: 0,
944-
selectionEnd: 3,
945-
wantPrefentDefault: true,
946-
})
947937
}
948938

949939
func Test_Editor_ProcessKeyDown_Callback(t *testing.T) {

playground/internal/react/codeBox.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (cba *codeBoxAssistant) SetCode(code string) { cba.setCode(code) }
8484
func (cba *codeBoxAssistant) EmitSave() { cba.onSave() }
8585
func (cba *codeBoxAssistant) EmitEscape() { cba.onEscape() }
8686

87+
// TODO(grantnelson-wf): Implement undo/redo stack since textarea
88+
// only handles undo/redo itself for non-programmatic changes but
89+
// doesn't handle undo/redo for when setCode is called.
90+
8791
func (cba *codeBoxAssistant) onInput(e *js.Object) {
8892
cba.setCode(e.Get(`target`).Get(`value`).String())
8993
}

0 commit comments

Comments
 (0)