File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
packages/selenium-ide/src/neo Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,17 @@ describe("Command", () => {
4141 command . setCommand ( "test invalid" ) ;
4242 expect ( command . isValid ) . toBeFalsy ( ) ;
4343 } ) ;
44+ it ( "should replace undefined input with empty strings" , ( ) => {
45+ const command = new Command ( ) ;
46+ command . setCommand ( ) ;
47+ command . setTarget ( ) ;
48+ command . setValue ( ) ;
49+ command . setComment ( ) ;
50+ expect ( command . command ) . toEqual ( "" ) ;
51+ expect ( command . target ) . toEqual ( "" ) ;
52+ expect ( command . value ) . toEqual ( "" ) ;
53+ expect ( command . comment ) . toEqual ( "" ) ;
54+ } ) ;
4455 it ( "should set the target" , ( ) => {
4556 const command = new Command ( ) ;
4657 command . setTarget ( "a" ) ;
Original file line number Diff line number Diff line change @@ -45,23 +45,23 @@ export default class Command {
4545 }
4646
4747 @action . bound setComment ( comment ) {
48- this . comment = comment ;
48+ this . comment = comment || "" ;
4949 }
5050
5151 @action . bound setCommand ( command ) {
5252 if ( CommandsValues [ command ] ) {
5353 this . command = CommandsValues [ command ] ;
5454 } else {
55- this . command = command ;
55+ this . command = command || "" ;
5656 }
5757 }
5858
5959 @action . bound setTarget ( target ) {
60- this . target = target ;
60+ this . target = target || "" ;
6161 }
6262
6363 @action . bound setValue ( value ) {
64- this . value = value . replace ( / \n / g, "\\n" ) ;
64+ this . value = value ? value . replace ( / \n / g, "\\n" ) : "" ;
6565 }
6666
6767 @action . bound toggleBreakpoint ( ) {
You can’t perform that action at this time.
0 commit comments