Skip to content

Commit c6cb7f3

Browse files
committed
Add test for handler
1 parent 9a2681e commit c6cb7f3

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

karma.conf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module.exports = function(config) {
1616

1717
// list of files / patterns to load in the browser
1818
files: [
19+
'./node_modules/phantomjs-polyfill-object-assign/object-assign-polyfill.js', //HOPE one day ditch PhantomJS polyfill
1920
'test/*.tsx'
2021
],
2122

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"karma-webpack": "^1.7.0",
5050
"mocha": "^3.0.1",
5151
"node-sass": "^3.8.0",
52+
"phantomjs-polyfill-object-assign": "0.0.2",
5253
"react": "^15.1.0",
5354
"react-addons-test-utils": "^15.3.0",
5455
"react-dom": "^15.1.0",

test/test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,24 @@ describe('<Console />', function() {
129129
expect(wrapper.find('.react-console-nofocus')).length(0);
130130
});
131131
});
132+
describe('[Property] handler: ', function () {
133+
it('Recieves input value', function(done) {
134+
function handler(command: string) {
135+
expect(command).equals('ababa');
136+
done();
137+
}
138+
var wrapper = enzyme.mount(<Console handler={handler}/>);
139+
var typer = wrapper.find('.react-console-typer');
140+
(typer.get(0) as HTMLTextAreaElement).value = 'ababa';
141+
typer.simulate('change');
142+
typer.simulate('keyDown', { keyCode: 13 /* Return */ });
143+
/*
144+
wrapper.setState({promptText: 'ababa'});
145+
var instance = wrapper.instance() as Console;
146+
instance.acceptLine();
147+
*/
148+
});
149+
});
132150
describe('[Property] promptLabel: ', function () {
133151
it('Has label \'> \' when promptLabel undefined', function() {
134152
var wrapper = enzyme.mount(<Console />);

0 commit comments

Comments
 (0)