Skip to content

Commit

Permalink
keep the text value as initialText
Browse files Browse the repository at this point in the history
  • Loading branch information
lerouxb committed Dec 11, 2024
1 parent 705f4ff commit be07c02
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/browser-repl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions packages/browser-repl/src/components/shell.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<ShellWrapper runtime={fakeRuntime} inputText={inputText} />);
expect(screen.getByRole('textbox').textContent).to.equal(inputText);
render(<ShellWrapper runtime={fakeRuntime} initialText={initialText} />);
expect(screen.getByRole('textbox').textContent).to.equal(initialText);
expect(filterEvaluateCalls(fakeRuntime.evaluate.args)).to.be.empty;
});

Expand Down
6 changes: 3 additions & 3 deletions packages/browser-repl/src/components/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -184,7 +184,7 @@ export const Shell = ({
onOperationStarted,
onOperationEnd,
initialEvaluate,
inputText,
initialText,
output,
history,
isOperationInProgress = false,
Expand Down Expand Up @@ -451,7 +451,7 @@ export const Shell = ({
/>
) : (
<ShellInput
initialText={inputText}
initialText={initialText}
onTextChange={onInputChanged}
prompt={shellPrompt}
autocompleter={runtime}
Expand Down

0 comments on commit be07c02

Please sign in to comment.