This is a migrated thread and some comments may be shown as answers.

Unable to unit test kendo grid with detailTemplate

5 Answers 352 Views
Integration with other JS libraries
This is a migrated thread and some comments may be shown as answers.
Rajesh
Top achievements
Rank 1
Rajesh asked on 10 Oct 2014, 06:11 PM
Hi,

I have kendo-grid with a detailTemplate

 detailTemplate:kendo.template($('#deviceDetails').html())

see http://dojo.telerik.com/@rtv/aCoc for a complete example.

Angular Jasmine unit tests fail to load a controller with this detailTemplate line in it with the following error

Note : line 131 in the following stack trace is detailTemplate:kendo.template($('#deviceDetails').html())


TypeError: e is undefined
z.compile@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/kendoUI/js/kendo.all.min.js:9:6980
.proxy/i@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/jquery/jquery1.9.1.min.js:3:6327
@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/scripts/controllers/deviceSummaryController.js:131:9
invoke@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/angular/angular.js:3906:7
instantiate@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/angular/angular.js:3917:7
$ControllerProvider/this.$get</<@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/angular/angular.js:7201:7
@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/test/spec/controllers/deviceSummaryControllerTest.js:124:76
invoke@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/angular/angular.js:3906:7
workFn@/Users/rtv/workspace/ioxmgr13March/ccm/ioxmgr/ioxmgr-ui/app/bower_components/angular-mocks/angular-mocks.js:2149:11


How can I get around this ?

-Rajesh

5 Answers, 1 is accepted

Sort by
0
Mihai
Telerik team
answered on 13 Oct 2014, 02:44 PM
Hello,

I see no obvious failure in the sample that you posted, and we can't offer any technical support for Angular Jasmine.  If you believe you've found a bug on our side, please clarify what the issue is -- expected behavior and what actually happens.

Regards,
Mihai
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rajesh
Top achievements
Rank 1
answered on 18 Oct 2014, 06:59 PM
Hi Mihai,

Expected behaviour - The unit tests are able to run tests where a controller has a line that defines the detailTemplate

What actually happens - None of the tests run since the test case fails to initialize the controller that has such a line. The error comes from the kendo.all.min.js as shown in the stack trace.

Can you help me move the detailedTemplate into the html instead ?

If Angular Jasmine is not supported, what is the recommended unit test framework for Kendo Angular implementations ?

Thanks,
Rajesh
0
Atanas Korchev
Telerik team
answered on 22 Oct 2014, 06:51 AM
Hello Rajesh,

We haven't seen the actual test so far and we can't be sure why it fails. The example you have provided works as expected which leaves us no room for troubleshooting.

We are not sure what moving the detail template to html means. Right now it is already in the HTML as a <script> element. Could you clarify?

Kendo UI doesn't claim official support for any unit testing framework. However people are successfully using Jasmine or QUnit. The public Kendo UI core tests are done in QUnit.

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Rajesh
Top achievements
Rank 1
answered on 23 Apr 2015, 03:54 AM

Hi,

 http://dojo.telerik.com/ICojO is a link to a Jasmine test that is broken when we use a detailTemplate. Please let me know what I am doing wrong.

 

-Rajesh

0
Atanas Korchev
Telerik team
answered on 23 Apr 2015, 06:44 AM
Hi,

This code detailTemplate:kendo.template($('#deviceDetails').html()),

fails because there is no HTML element in this page with id attribute set to "deviceDetails". As a result $('#deviceDetails').html() returns "undefined".

Regards,
Atanas Korchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Integration with other JS libraries
Asked by
Rajesh
Top achievements
Rank 1
Answers by
Mihai
Telerik team
Rajesh
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or