File tree Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,13 @@ describe("Toolbar: no-csp: ", function() {
66    beforeEach ( function ( )  { 
77
88        container  =  $ ( "<div id='toolbar' />" ) . appendTo ( Mocha . fixture ) ; 
9+ 
10+         Mocha . fixture . append ( 
11+             `<script id="myTemplate" type="text/x-kendo-template"> 
12+                         <button id="btn1">fooo</button> 
13+                         <script>$("\\#btn1").kendoButton({themeColor:"warning"})<\\/script> 
14+                     </script>` 
15+         ) ; 
916    } ) ; 
1017
1118    afterEach ( function ( )  { 
@@ -25,4 +32,15 @@ describe("Toolbar: no-csp: ", function() {
2532        assert . equal ( toolbar . element . find ( "#foo" ) . text ( ) ,  "test" ) ; 
2633    } ) ; 
2734
35+     it ( "external template is evaluated when wrapper components are used in template" ,  function ( )  { 
36+         let  toolbar  =  container . kendoToolBar ( { 
37+             items : [ 
38+                 {  template : kendo . template ( $ ( "#myTemplate" ) . html ( ) )  } 
39+             ] 
40+         } ) . data ( "kendoToolBar" ) ; 
41+ 
42+         let  btn  =  kendo . widgetInstance ( $ ( "#btn1" ) ) ; 
43+         assert . isOk ( btn  instanceof  kendo . ui . Button ) ; 
44+     } ) ; 
45+ 
2846} ) ; 
Original file line number Diff line number Diff line change @@ -1680,6 +1680,40 @@ describe("Toolbar rendering:", function() {
16801680        assert . isOk ( $ ( "#foo" ) . hasClass ( "foo" ) ) ; 
16811681    } ) ; 
16821682
1683+     it ( "template handler is evaluated when wrapper components are used in template" ,  function ( done )  { 
1684+ 
1685+         let  toolbar  =  container . kendoToolBar ( { 
1686+             items : [ { 
1687+                 template : function ( data )  { 
1688+                     var  result  =  '' ; 
1689+                     result  +=  `<button id="btn" name="btn">foo</button>` ;  /*kendoTmpPlaceholder*/ 
1690+                     queueMicrotask ( ( )  =>  { 
1691+                         jQuery ( `#btn` ) . kendoButton ( { 
1692+                             "themeColor" : `warning` 
1693+                         } ) ; 
1694+ 
1695+                         let  btn  =  $ ( "#btn" ) . getKendoButton ( ) ; 
1696+                         assert . isOk ( btn  instanceof  kendo . ui . Button ) ; 
1697+                     } ) ; 
1698+                     return  result ; 
1699+                 } 
1700+             } ] 
1701+         } ) . data ( "kendoToolBar" ) ; 
1702+     } ) ; 
1703+ 
1704+     it ( "string template is evaluated when wrapper components are used in template" ,  function ( )  { 
1705+ 
1706+         let  toolbar  =  container . kendoToolBar ( { 
1707+             items : [ 
1708+                 {  template : '<button id="btn2">fooo</button><script>$("\#btn2").kendoButton({themeColor:"success"})<\/script>'  } , 
1709+ 
1710+             ] 
1711+         } ) . data ( "kendoToolBar" ) ; 
1712+ 
1713+         let  btn  =  kendo . widgetInstance ( $ ( "#btn2" ) ) ; 
1714+         assert . isOk ( btn  instanceof  kendo . ui . Button ) ; 
1715+     } ) ; 
1716+ 
16831717    /* MISC */ 
16841718    it ( "click event of disabled button is prevented" ,  function ( )  { 
16851719        container . kendoToolBar ( { 
@@ -1809,4 +1843,4 @@ describe("Toolbar rendering:", function() {
18091843        assert . equal ( container . find ( ".k-spacer" ) . index ( ) ,  1 ) ; 
18101844    } ) ; 
18111845
1812- } ) ; 
1846+ } ) ; 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments