From be07c02724224be9af4f9e3215490a38b70cf712 Mon Sep 17 00:00:00 2001 From: Le Roux Bodenstein Date: Wed, 11 Dec 2024 17:16:05 +0000 Subject: [PATCH] keep the text value as initialText --- packages/browser-repl/README.md | 2 +- packages/browser-repl/src/components/shell.spec.tsx | 8 ++++---- packages/browser-repl/src/components/shell.tsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/browser-repl/README.md b/packages/browser-repl/README.md index e5594e251..0203ef7c8 100644 --- a/packages/browser-repl/README.md +++ b/packages/browser-repl/README.md @@ -40,7 +40,7 @@ Shell is a React component with the following properties: - `maxOutputLength?: number`: The maxiumum number of lines to keep in the output. Defaults to `1000`. - `maxHistoryLength?: number`: The maxiumum number of lines to keep in the history. Defaults to `1000`. - `initialEvaluate?: string|string[]`: A set of input strings to evaluate right after shell is mounted. -- `inputText?: string`: The text for the input field. +- `initialText?: string`: The initial text for the input field. - `output?: ShellOutputEntry[]`: An array of entries to be displayed in the output area. Can be used to restore the output between sessions, or to setup a greeting message. **Note**: new entries will not be appended to the array. - `history?: readonly string[]`: An array of history entries to prepopulate the history. Can be used to restore the history between sessions. Entries must be ordered from the most recent to the oldest. Note: new entries will not be appended to the array. diff --git a/packages/browser-repl/src/components/shell.spec.tsx b/packages/browser-repl/src/components/shell.spec.tsx index b734a644a..b9d6d551d 100644 --- a/packages/browser-repl/src/components/shell.spec.tsx +++ b/packages/browser-repl/src/components/shell.spec.tsx @@ -160,11 +160,11 @@ describe('shell', function () { expect(filterEvaluateCalls(fakeRuntime.evaluate.args)).to.have.length(1); }); - it('takes inputText', function () { - const inputText = 'still typing'; + it('takes initialText', function () { + const initialText = 'still typing'; - render(); - expect(screen.getByRole('textbox').textContent).to.equal(inputText); + render(); + expect(screen.getByRole('textbox').textContent).to.equal(initialText); expect(filterEvaluateCalls(fakeRuntime.evaluate.args)).to.be.empty; }); diff --git a/packages/browser-repl/src/components/shell.tsx b/packages/browser-repl/src/components/shell.tsx index af015f119..89cefd2c4 100644 --- a/packages/browser-repl/src/components/shell.tsx +++ b/packages/browser-repl/src/components/shell.tsx @@ -112,7 +112,7 @@ interface ShellProps { /** * Initial value in the shell input field */ - inputText?: string; + initialText?: string; /* An array of entries to be displayed in the output area. * @@ -184,7 +184,7 @@ export const Shell = ({ onOperationStarted, onOperationEnd, initialEvaluate, - inputText, + initialText, output, history, isOperationInProgress = false, @@ -451,7 +451,7 @@ export const Shell = ({ /> ) : (