@@ -268,26 +268,159 @@ describe("KdbDataSourceView", () => {
268268 } ) ;
269269
270270 describe ( "renderCheckbox" , ( ) => {
271- const param : UDAParam = dummyUDAs [ 0 ] . params [ 0 ] ;
272- it ( "should render checkbox" , ( ) => {
273- param . value = "true" ;
271+ it ( "should render checkbox with value true" , ( ) => {
272+ const param : UDAParam = {
273+ name : "testParam" ,
274+ description : "Test Description" ,
275+ value : true ,
276+ default : false ,
277+ isReq : false ,
278+ type : 0 ,
279+ } ;
274280 const result = view . renderCheckbox ( param ) ;
275281 assert . ok ( result ) ;
276282 } ) ;
277283
278- it ( "should render checkbox with defaultvalue" , ( ) => {
279- param . value = undefined ;
280- param . default = false ;
284+ it ( "should render checkbox with value false" , ( ) => {
285+ const param : UDAParam = {
286+ name : "testParam" ,
287+ description : "Test Description" ,
288+ value : false ,
289+ default : true ,
290+ isReq : false ,
291+ type : 0 ,
292+ } ;
281293 const result = view . renderCheckbox ( param ) ;
282294 assert . ok ( result ) ;
283295 } ) ;
284296
285- it ( "should render checkbox with defaultvalue" , ( ) => {
286- param . value = undefined ;
287- param . default = undefined ;
297+ it ( "should render checkbox with default value true" , ( ) => {
298+ const param : UDAParam = {
299+ name : "testParam" ,
300+ description : "Test Description" ,
301+ value : undefined ,
302+ default : true ,
303+ isReq : false ,
304+ type : 0 ,
305+ } ;
288306 const result = view . renderCheckbox ( param ) ;
289307 assert . ok ( result ) ;
290308 } ) ;
309+
310+ it ( "should render checkbox with default value false" , ( ) => {
311+ const param : UDAParam = {
312+ name : "testParam" ,
313+ description : "Test Description" ,
314+ value : undefined ,
315+ default : false ,
316+ isReq : false ,
317+ type : 0 ,
318+ } ;
319+ const result = view . renderCheckbox ( param ) ;
320+ assert . ok ( result ) ;
321+ } ) ;
322+
323+ it ( "should render checkbox with value and default undefined" , ( ) => {
324+ const param : UDAParam = {
325+ name : "testParam" ,
326+ description : "Test Description" ,
327+ value : undefined ,
328+ default : undefined ,
329+ isReq : false ,
330+ type : 0 ,
331+ } ;
332+ const result = view . renderCheckbox ( param ) ;
333+ assert . ok ( result ) ;
334+ } ) ;
335+ } ) ;
336+
337+ describe ( "renderTextarea" , ( ) => {
338+ it ( "should render textarea with value" , ( ) => {
339+ const param : UDAParam = {
340+ name : "testParam" ,
341+ description : "Test Description" ,
342+ value : "Test Value" ,
343+ default : "" ,
344+ isReq : false ,
345+ type : 0 ,
346+ } ;
347+ const result = view . renderTextarea ( param ) ;
348+ assert . ok ( result ) ;
349+ } ) ;
350+
351+ it ( "should render textarea with default value" , ( ) => {
352+ const param : UDAParam = {
353+ name : "testParam" ,
354+ description : "Test Description" ,
355+ value : undefined ,
356+ default : "Default Value" ,
357+ isReq : false ,
358+ type : 0 ,
359+ } ;
360+ const result = view . renderTextarea ( param ) ;
361+ assert . ok ( result ) ;
362+ } ) ;
363+
364+ it ( "should render textarea with empty value when both value and default are undefined" , ( ) => {
365+ const param : UDAParam = {
366+ name : "testParam" ,
367+ description : "Test Description" ,
368+ value : undefined ,
369+ default : undefined ,
370+ isReq : false ,
371+ type : 0 ,
372+ } ;
373+ const result = view . renderTextarea ( param ) ;
374+ assert . ok ( result ) ;
375+ } ) ;
376+ } ) ;
377+ describe ( "renderMultitype" , ( ) => {
378+ it ( "should render multitype with selectedMultiTypeString" , ( ) => {
379+ const param : UDAParam = {
380+ name : "testParam" ,
381+ description : "Test Description" ,
382+ value : "" ,
383+ default : "" ,
384+ isReq : true ,
385+ type : 1 ,
386+ selectedMultiTypeString : "type1" ,
387+ typeStrings : [ "type1" , "type2" ] ,
388+ } ;
389+ const result = view . renderMultitype ( param ) ;
390+ assert . ok ( result ) ;
391+ } ) ;
392+
393+ it ( "should render multitype with first typeString when selectedMultiTypeString is undefined" , ( ) => {
394+ const param : UDAParam = {
395+ name : "testParam" ,
396+ description : "Test Description" ,
397+ value : "" ,
398+ default : "" ,
399+ isReq : true ,
400+ type : 1 ,
401+ selectedMultiTypeString : undefined ,
402+ typeStrings : [ "type1" , "type2" ] ,
403+ } ;
404+ const result = view . renderMultitype ( param ) ;
405+ assert . ok ( result ) ;
406+ assert . strictEqual ( param . selectedMultiTypeString , "type1" ) ;
407+ } ) ;
408+
409+ it ( "should render multitype with empty string when selectedMultiTypeString and typeStrings are undefined" , ( ) => {
410+ const param : UDAParam = {
411+ name : "testParam" ,
412+ description : "Test Description" ,
413+ value : "" ,
414+ default : "" ,
415+ isReq : true ,
416+ type : 1 ,
417+ selectedMultiTypeString : undefined ,
418+ typeStrings : undefined ,
419+ } ;
420+ const result = view . renderMultitype ( param ) ;
421+ assert . ok ( result ) ;
422+ assert . strictEqual ( param . selectedMultiTypeString , "" ) ;
423+ } ) ;
291424 } ) ;
292425
293426 describe ( "renderUDAInvalidParams" , ( ) => {
0 commit comments