小编mar*_*lon的帖子

单元测试使用Kendo Grid/Datasource的Angular Controller

我的项目是使用AngularJS + Kendo-UI.我正在尝试测试一个使用Kendo-UI Grid的控制器:

angular.module('myApp')('DevicesCtrl', function ($scope) {

    $scope.gridOptions = {
        dataSource: {
            transport: {
                read: {
                    url: "/devices",
                    dataType: "json"
                }
            },
            change: function(){
                var view = this.view();
                $scope.devices = [];

                $.each(view, function(i, v) {
                    $scope.devices.push({id: v.id, description: v.name, status: v.status  == 0 ? "failure" : "success"});
                });
                $scope.$apply();
            }
        },
        columns: [
            {
                field: "name",
                title: "Name",
                width: 250,
                template: function (item) {
                    var itemStatus = item.status == 0 ? 'failure' : 'success';
                    return '<div label size="small" operation="' …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing kendo-ui angularjs kendo-grid

3
推荐指数
1
解决办法
2206
查看次数