summaryrefslogtreecommitdiff
path: root/test/behaviour/keys.zig
diff options
context:
space:
mode:
Diffstat (limited to 'test/behaviour/keys.zig')
-rw-r--r--test/behaviour/keys.zig16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/behaviour/keys.zig b/test/behaviour/keys.zig
index 6a62ccd7..6256a0b7 100644
--- a/test/behaviour/keys.zig
+++ b/test/behaviour/keys.zig
@@ -25,11 +25,12 @@ test "keys: a prompt's entry and cancellation leave the tag, the body and its cu
try s.write(dot, "6 6");
try s.keys(case.keys);
// The answer is typed into the tag's head (walk UI), shown in place
- // of the tag's own text, which it never touches.
+ // of the tag's own text, which it never touches; out of rest the
+ // path is hidden too (UX D1): the head starts the tag.
try s.keys("zq");
_ = try s.where(case.shown);
const head = try s.read(tag);
- try std.testing.expect(std.mem.startsWith(u8, head, "/test.txt") and std.mem.startsWith(u8, head["/test.txt".len..], case.shown));
+ try std.testing.expect(std.mem.startsWith(u8, head, case.shown[1..]));
try s.keys("\x1b");
try std.testing.expectError(error.NotOnScreen, s.where(case.shown));
try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal "));
@@ -387,12 +388,17 @@ test "keys: a PDF in normal mode keeps : (its tag and back), SPC (a leader, canc
try std.testing.expect(std.mem.endsWith(u8, try s.read(s.at("/pane/{d}/ctl", .{n})), " mode:normal "));
try s.keys(":");
try std.testing.expect(try s.cursor() == null);
- // The leader shows its key cell in the tag at once (walk UI) until a
+ // The leader changes nothing in the tag before its level shows (walk
+ // UI, UX D12): its key on the notice row's right end at once, until a
// key the PDF takes, which takes the leader away.
+ const before = try std.testing.allocator.dupe(u8, try panesShown(&s));
+ defer std.testing.allocator.free(before);
try s.keys(" ");
- try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " ␣ ") != null);
+ try std.testing.expectEqualStrings(before, try panesShown(&s));
+ const shown = try s.screen();
+ try std.testing.expect(std.mem.endsWith(u8, std.mem.trimEnd(u8, shown[std.mem.lastIndexOfScalar(u8, shown, '\n').? + 1 ..], " "), "SPC"));
try s.keys("!");
- try std.testing.expect(std.mem.indexOf(u8, try panesShown(&s), " ␣ ") == null);
+ try std.testing.expectEqualStrings(before, try panesShown(&s));
try s.keys("/");
try std.testing.expect(try s.cursor() != null);
try std.testing.expectEqual(n, try s.focused());