Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upimplement RemoveShortcut #1290
implement RemoveShortcut #1290
Conversation
Looks good! |
@@ -15,6 +15,22 @@ func TestShortcutHandler_AddShortcut(t *testing.T) { | |||
assert.Equal(t, 2, len(handle.entry)) | |||
} | |||
|
|||
func TestShortcutHandler_RemoveShortut(t *testing.T) { |
toaster
Sep 8, 2020
Member
Suggested change
func TestShortcutHandler_RemoveShortut(t *testing.T) {
func TestShortcutHandler_RemoveShortcut(t *testing.T) {
func TestShortcutHandler_RemoveShortut(t *testing.T) { | |
func TestShortcutHandler_RemoveShortcut(t *testing.T) { |
handle := &ShortcutHandler{} | ||
handle.AddShortcut(&ShortcutCopy{}, func(shortcut Shortcut) {}) | ||
handle.AddShortcut(&ShortcutPaste{}, func(shortcut Shortcut) {}) | ||
|
||
assert.Equal(t, 2, len(handle.entry)) | ||
|
||
handle.RemoveShortcut(&ShortcutCopy{}) | ||
|
||
assert.Equal(t, 1, len(handle.entry)) | ||
|
||
handle.RemoveShortcut(&ShortcutPaste{}) | ||
|
||
assert.Equal(t, 0, len(handle.entry)) |
toaster
Sep 8, 2020
Member
Suggested change
handle := &ShortcutHandler{}
handle.AddShortcut(&ShortcutCopy{}, func(shortcut Shortcut) {})
handle.AddShortcut(&ShortcutPaste{}, func(shortcut Shortcut) {})
assert.Equal(t, 2, len(handle.entry))
handle.RemoveShortcut(&ShortcutCopy{})
assert.Equal(t, 1, len(handle.entry))
handle.RemoveShortcut(&ShortcutPaste{})
assert.Equal(t, 0, len(handle.entry))
handler := &ShortcutHandler{}
handler.AddShortcut(&ShortcutCopy{}, func(shortcut Shortcut) {})
handler.AddShortcut(&ShortcutPaste{}, func(shortcut Shortcut) {})
assert.Equal(t, 2, len(handler.entry))
handler.RemoveShortcut(&ShortcutCopy{})
assert.Equal(t, 1, len(handler.entry))
handler.RemoveShortcut(&ShortcutPaste{})
assert.Equal(t, 0, len(handler.entry))
handle := &ShortcutHandler{} | |
handle.AddShortcut(&ShortcutCopy{}, func(shortcut Shortcut) {}) | |
handle.AddShortcut(&ShortcutPaste{}, func(shortcut Shortcut) {}) | |
assert.Equal(t, 2, len(handle.entry)) | |
handle.RemoveShortcut(&ShortcutCopy{}) | |
assert.Equal(t, 1, len(handle.entry)) | |
handle.RemoveShortcut(&ShortcutPaste{}) | |
assert.Equal(t, 0, len(handle.entry)) | |
handler := &ShortcutHandler{} | |
handler.AddShortcut(&ShortcutCopy{}, func(shortcut Shortcut) {}) | |
handler.AddShortcut(&ShortcutPaste{}, func(shortcut Shortcut) {}) | |
assert.Equal(t, 2, len(handler.entry)) | |
handler.RemoveShortcut(&ShortcutCopy{}) | |
assert.Equal(t, 1, len(handler.entry)) | |
handler.RemoveShortcut(&ShortcutPaste{}) | |
assert.Equal(t, 0, len(handler.entry)) |
kevingentile
Sep 8, 2020
Author
Contributor
Note, this change is inconsistent with the existing tests in this file
Note, this change is inconsistent with the existing tests in this file
Looks good - @toaster can you please confirm if you are happy with the changes |
Looks llike the file was changed a lot so some merge conflicts to resolve @kevingentile sorry |
9d7788d
to
a5ff42a
a5ff42a
to
b0dedcb
Static check failing: /home/runner/work/fyne/fyne/shortcut.go |
Description:
Addresses #1278 for shortcut cleanup
Checklist:
Where applicable: