Do not skip the tests

This commit is contained in:
Alexander Farber
2025-12-09 16:46:18 +01:00
parent 06c398a015
commit 5b74422be6
2 changed files with 7 additions and 9 deletions

View File

@@ -1252,8 +1252,7 @@ describe('InputPrompt', () => {
unmount(); unmount();
}); });
// Skip: trailing cursor (inverted space at EOL) is trimmed without right border it('should display cursor at the end of the line as an inverted space', async () => {
it.skip('should display cursor at the end of the line as an inverted space', async () => {
mockBuffer.text = 'hello'; mockBuffer.text = 'hello';
mockBuffer.lines = ['hello']; mockBuffer.lines = ['hello'];
mockBuffer.viewportVisualLines = ['hello']; mockBuffer.viewportVisualLines = ['hello'];
@@ -1303,13 +1302,12 @@ describe('InputPrompt', () => {
unmount(); unmount();
}); });
// Skip: trailing cursor (inverted space at EOL) is trimmed without right border it('should display cursor at the end of a line with unicode characters', async () => {
it.skip('should display cursor at the end of a line with unicode characters', async () => {
const text = 'hello 👍'; const text = 'hello 👍';
mockBuffer.text = text; mockBuffer.text = text;
mockBuffer.lines = [text]; mockBuffer.lines = [text];
mockBuffer.viewportVisualLines = [text]; mockBuffer.viewportVisualLines = [text];
mockBuffer.visualCursor = [0, 8]; // cursor after '👍' (length is 6 + 2 for emoji) mockBuffer.visualCursor = [0, 7]; // cursor after '👍' (emoji is 1 code point, so total is 7)
const { stdout, unmount } = renderWithProviders( const { stdout, unmount } = renderWithProviders(
<InputPrompt {...props} />, <InputPrompt {...props} />,
@@ -1396,8 +1394,7 @@ describe('InputPrompt', () => {
unmount(); unmount();
}); });
// Skip: trailing cursor (inverted space at EOL) is trimmed without right border it('should display cursor at the end of a line in a multiline block', async () => {
it.skip('should display cursor at the end of a line in a multiline block', async () => {
const text = 'first line\nsecond line'; const text = 'first line\nsecond line';
mockBuffer.text = text; mockBuffer.text = text;
mockBuffer.lines = text.split('\n'); mockBuffer.lines = text.split('\n');
@@ -1469,7 +1466,7 @@ describe('InputPrompt', () => {
// Check that all lines, including the empty one, are rendered. // Check that all lines, including the empty one, are rendered.
// This implicitly tests that the Box wrapper provides height for the empty line. // This implicitly tests that the Box wrapper provides height for the empty line.
expect(frame).toContain('hello'); expect(frame).toContain('hello');
expect(frame).toContain('world'); expect(frame).toContain(`world${chalk.inverse(' ')}`);
const outputLines = frame!.split('\n'); const outputLines = frame!.split('\n');
// The number of lines should be 2 for the border plus 3 for the content. // The number of lines should be 2 for the border plus 3 for the content.

View File

@@ -834,9 +834,10 @@ export const InputPrompt: React.FC<InputPromptProps> = ({
isOnCursorLine && isOnCursorLine &&
cursorVisualColAbsolute === cpLen(lineText) cursorVisualColAbsolute === cpLen(lineText)
) { ) {
// Add zero-width space after cursor to prevent Ink from trimming trailing whitespace
renderedLine.push( renderedLine.push(
<Text key={`cursor-end-${cursorVisualColAbsolute}`}> <Text key={`cursor-end-${cursorVisualColAbsolute}`}>
{showCursor ? chalk.inverse(' ') : ' '} {showCursor ? chalk.inverse(' ') + '\u200B' : ' \u200B'}
</Text>, </Text>,
); );
} }