Skip to content

Commit 88762b5

Browse files
committed
Begin testing promptLabel
1 parent d43d110 commit 88762b5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/react-console.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export default class extends React.Component<ConsoleProps,ConsoleState> {
168168
promptLabel: '> ',
169169
continue: function() { return false; },
170170
cancel: function() {},
171+
handler: function() { this.return() },
171172
};
172173
child: {
173174
typer?: HTMLTextAreaElement;

test/test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,16 @@ describe('<Console />', function() {
129129
expect(wrapper.find('.react-console-nofocus')).length(0);
130130
});
131131
});
132+
describe('[Property] promptLabel: ', function () {
133+
it('Has label \'> \' when promptLabel undefined', function() {
134+
var wrapper = enzyme.mount(<Console />);
135+
expect(wrapper.find('.react-console-prompt-label').text()).equals('> ');
136+
});
137+
it('Has label \'ababa: \' when promptLabel=\'ababa:\' ', function() {
138+
var wrapper = enzyme.mount(<Console promptLabel='ababa: '/>);
139+
expect(wrapper.find('.react-console-prompt-label').text()).equals('ababa: ');
140+
});
141+
});
132142
describe('[Property] welcomeMessage: ', function () {
133143
it('Doesn\'t have class `react-console-welcome` when welcomeMessage undefined', function() {
134144
var wrapper = enzyme.shallow(<Console />);

0 commit comments

Comments
 (0)