-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add bookmark when viewing logs
Summary: Now when you are on a log buffer you can use <C-b> to add a bookmark to the current node. Test Plan: Tests have been added and we have CI. I have also been using this for quite a while now locally.
- Loading branch information
1 parent
cb8ebef
commit 3040525
Showing
4 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
require "sapling_scm_tests.setup" | ||
|
||
local actions = require "sapling_scm.log_actions" | ||
local editor_command = require "sapling_scm.editor_command" | ||
|
||
local stub = require("busted").stub | ||
local match = require("busted").match | ||
|
||
describe("bookmark", function() | ||
vim.cmd "edit sl://show/." | ||
stub(editor_command, "run") | ||
|
||
teardown(function() | ||
editor_command.run:revert() | ||
end) | ||
|
||
describe("with no bookmark added in the input", function() | ||
stub(vim.ui, "input", function(_, callback) | ||
callback(nil) | ||
end) | ||
|
||
teardown(function() | ||
vim.ui.input:revert() | ||
end) | ||
|
||
actions.bookmark() | ||
|
||
it("calls vim.ui.input when the bookmark is called", function() | ||
assert.stub(vim.ui.input).was_called_with(match.is_table(), match.is_function()) | ||
end) | ||
|
||
it("dose not call the editor_command.run", function() | ||
assert.stub(editor_command.run).was_not_called() | ||
end) | ||
end) | ||
|
||
describe("with a name in the callback for the input", function() | ||
stub(vim.ui, "input", function(_, callback) | ||
callback "MY_BOOKMARK" | ||
end) | ||
|
||
teardown(function() | ||
vim.ui.input:revert() | ||
end) | ||
|
||
actions.bookmark() | ||
|
||
it("calls vim.ui.input when the bookmark is called", function() | ||
assert.stub(vim.ui.input).was_called_with(match.is_table(), match.is_function()) | ||
end) | ||
|
||
it("calls the editor command to create a bookmark", function() | ||
assert.stub(editor_command.run).was_called_with(match.has_match "sl bookmark") | ||
end) | ||
end) | ||
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters