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() {
6
6
beforeEach ( function ( ) {
7
7
8
8
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
+ ) ;
9
16
} ) ;
10
17
11
18
afterEach ( function ( ) {
@@ -25,4 +32,15 @@ describe("Toolbar: no-csp: ", function() {
25
32
assert . equal ( toolbar . element . find ( "#foo" ) . text ( ) , "test" ) ;
26
33
} ) ;
27
34
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
+
28
46
} ) ;
Original file line number Diff line number Diff line change @@ -1680,6 +1680,40 @@ describe("Toolbar rendering:", function() {
1680
1680
assert . isOk ( $ ( "#foo" ) . hasClass ( "foo" ) ) ;
1681
1681
} ) ;
1682
1682
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
+
1683
1717
/* MISC */
1684
1718
it ( "click event of disabled button is prevented" , function ( ) {
1685
1719
container . kendoToolBar ( {
@@ -1809,4 +1843,4 @@ describe("Toolbar rendering:", function() {
1809
1843
assert . equal ( container . find ( ".k-spacer" ) . index ( ) , 1 ) ;
1810
1844
} ) ;
1811
1845
1812
- } ) ;
1846
+ } ) ;
You can’t perform that action at this time.
0 commit comments