Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon McLean committed Sep 14, 2024
1 parent a91a6f8 commit 0458765
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions tests/specs/ui_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ describe('Triptych UI', {
end)
end),

test('when copying-pasting, publishes public events for files (not folders)', function(done)
test('when copying-pasting a folder, publishes public events for the files (but not the folders)', function(done)
local base_dir = u.join_path(cwd, 'tests/test_playground/level_1/level_2')

local expected_events = {
Expand All @@ -352,7 +352,6 @@ describe('Triptych UI', {
u.on_events({
{ name = 'TriptychDidCreateNode', wait_for_n = 2 },
}, function(events)
local state = u.get_state()
close_triptych(function()
done {
assertions = function()
Expand All @@ -369,6 +368,41 @@ describe('Triptych UI', {
end)
end),

test('when copying-pasting a file, publishes public events', function(done)
local expected_events = {
['TriptychWillCreateNode'] = {
{ path = u.join_path(opening_dir, 'level_3_file_1_copy1.md') },
},
['TriptychDidCreateNode'] = {
{ path = u.join_path(opening_dir, 'level_3_file_1_copy1.md') },
},
}

open_triptych(function()
-- Move down to the file and copy
u.press_keys 'jc'
u.on_primary_window_updated(function()
-- Paste
u.press_keys 'p'
u.on_events({
{ name = 'TriptychWillCreateNode', wait_for_n = 1 },
{ name = 'TriptychDidCreateNode', wait_for_n = 1 },
}, function(events)
close_triptych(function()
done {
assertions = function()
assert.same(expected_events, events)
end,
cleanup = function()
vim.fn.delete(u.join_path(opening_dir, 'level_3_file_1_copy1.md'))
end,
}
end)
end)
end)
end)
end),

test('copies files', function(done)
local expected_lines = {
primary = {
Expand Down

0 comments on commit 0458765

Please sign in to comment.