diff options
Diffstat (limited to 'test/panes.zig')
| -rw-r--r-- | test/panes.zig | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/panes.zig b/test/panes.zig index 935defb5..41061bea 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -367,6 +367,8 @@ const TagNavigationTests = struct { p.update(.{ .key = .{ .cp = 'x', .text = "x" } }); try std.testing.expect(pane.prompt == .name); try std.testing.expectEqualStrings("x/test.txt", pane.input.own.?); + // Esc keeps the draft pending; a second drops it. + key(p, Key.escape); key(p, Key.escape); try std.testing.expect(pane.prompt == .none); try std.testing.expectEqualStrings("/test.txt", pane.file.?.path); @@ -1621,7 +1623,9 @@ test "pane filename drafts commit and cancel without changing body or command ta try std.testing.expectEqualStrings("/new name.zig", pane.input.own.?); try std.testing.expectEqualStrings(tail, pardes.tagline.curTail(pane)); try std.testing.expectEqualStrings("original body\n", pane.file.?.content); + // Esc keeps the draft pending; a second drops it. p.update(.{ .key = .{ .cp = if (commit) Key.enter else Key.escape } }); + if (!commit) p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(pane.focus == .body); try std.testing.expect(pane.prompt == .none); try std.testing.expectEqualStrings(if (commit) "/new name.zig" else original, pane.file.?.path); @@ -1649,6 +1653,9 @@ test "pane filename grapheme edits and invalid empty commits preserve the buffer try std.testing.expect(pane.prompt == .name); try std.testing.expectEqualStrings("/test.txt", pane.file.?.path); try std.testing.expectEqualStrings("untouched\n", pane.file.?.content); + // Esc keeps the draft pending; a second drops it. + p.update(.{ .key = .{ .cp = Key.escape } }); + try std.testing.expect(pane.prompt == .name); p.update(.{ .key = .{ .cp = Key.escape } }); try std.testing.expect(pane.prompt == .none); } @@ -3142,7 +3149,7 @@ const ImageTests = struct { toggleGlyphArt(&state); togglePalette(&state); toggleAscii(&state); - const tag = try tagPrefix(std.testing.allocator, &state); + const tag = try tagPrefix(std.testing.allocator, &state, state.glyph_art); defer std.testing.allocator.free(tag); try std.testing.expectEqualStrings( config.tag_image ++ " petscii:on palette:terminal ascii:off /tmp/picture.ppm", |
