@@ -521,6 +521,97 @@ describe('Chart Control', () => {
521521 expect ( document . getElementById ( 'EJ2_Chart_ZoomTip' ) . innerHTML ) . toEqual ( " Zoom " ) ;
522522 } ) ;
523523 } ) ;
524+ describe ( 'Chart checking no data template' , ( ) => {
525+ let chart : Chart ;
526+ let ele : HTMLElement ;
527+ beforeAll ( ( ) : void => {
528+ ele = createElement ( 'div' , { id : 'container' } ) ;
529+ document . body . appendChild ( ele ) ;
530+ chart = new Chart ( ) ;
531+ chart . appendTo ( '#container' ) ;
532+ } ) ;
533+
534+ afterAll ( ( ) : void => {
535+ chart . destroy ( ) ;
536+ ele . remove ( ) ;
537+ } ) ;
538+ it ( 'checking no data template element' , ( done : Function ) => {
539+ chart . loaded = ( args : ILoadedEventArgs ) => {
540+ chart . loaded = null ;
541+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
542+ expect ( templateElement != null ) ;
543+ done ( ) ;
544+ } ;
545+ chart . noDataTemplate = '<div>No data template</div>' ;
546+ chart . refresh ( ) ;
547+ } ) ;
548+ it ( 'checking with title' , ( done : Function ) => {
549+ chart . loaded = ( args : ILoadedEventArgs ) => {
550+ chart . loaded = null ;
551+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
552+ expect ( templateElement != null ) ;
553+ done ( ) ;
554+ } ;
555+ chart . enableHtmlSanitizer = true ;
556+ chart . title = 'Title' ;
557+ chart . subTitle = 'Title' ;
558+ chart . refresh ( ) ;
559+ } ) ;
560+ it ( 'checking with title position left' , ( done : Function ) => {
561+ chart . loaded = ( args : ILoadedEventArgs ) => {
562+ chart . loaded = null ;
563+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
564+ expect ( templateElement != null ) ;
565+ done ( ) ;
566+ } ;
567+ chart . enableHtmlSanitizer = true ;
568+ chart . title = 'Title' ;
569+ chart . subTitle = 'Title' ;
570+ chart . titleStyle . position = 'Left' ;
571+ chart . refresh ( ) ;
572+ } ) ;
573+ it ( 'checking with title position Bottom' , ( done : Function ) => {
574+ chart . loaded = ( args : ILoadedEventArgs ) => {
575+ chart . loaded = null ;
576+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
577+ expect ( templateElement != null ) ;
578+ done ( ) ;
579+ } ;
580+ chart . enableHtmlSanitizer = true ;
581+ chart . title = 'Title' ;
582+ chart . subTitle = 'Title' ;
583+ chart . titleStyle . position = 'Bottom' ;
584+ chart . refresh ( ) ;
585+ } ) ;
586+ it ( 'checking with title position Right' , ( done : Function ) => {
587+ chart . loaded = ( args : ILoadedEventArgs ) => {
588+ chart . loaded = null ;
589+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
590+ expect ( templateElement != null ) ;
591+ done ( ) ;
592+ } ;
593+ chart . enableHtmlSanitizer = true ;
594+ chart . title = 'Title' ;
595+ chart . subTitle = 'Title' ;
596+ chart . titleStyle . position = 'Right' ;
597+ chart . refresh ( ) ;
598+ } ) ;
599+ it ( 'checking with title position Custom' , ( done : Function ) => {
600+ chart . loaded = ( args : ILoadedEventArgs ) => {
601+ chart . loaded = null ;
602+ const templateElement : HTMLElement = document . getElementById ( 'container_NoDataTemplate_wrapper' ) ;
603+ expect ( templateElement != null ) ;
604+ done ( ) ;
605+ } ;
606+ chart . enableHtmlSanitizer = true ;
607+ chart . title = 'Title' ;
608+ chart . subTitle = 'Title' ;
609+ chart . titleStyle . position = 'Custom' ;
610+ chart . titleStyle . x = 250 ;
611+ chart . titleStyle . y = 100 ;
612+ chart . refresh ( ) ;
613+ } ) ;
614+ } ) ;
524615 describe ( 'Chart checking center aligned div' , ( ) => {
525616 let chart : Chart ;
526617 let ele : HTMLElement ;
0 commit comments