मैंने एनजी-टेबल का उपयोग करके एक एप्लीकेशन बनाया है, एप्लिकेशन ठीक काम कर रहा है लेकिन जब मैंने एक जैस्मीन टेस्ट केस लिखा है तो मुझे मिल रहा है।कोणीयजेएस - जैस्मीन परीक्षण मामले में ngTableParams का मज़ाक उड़ाते हुए
Error: [$injector:unpr] Unknown provider: TableParamsProvider
किसी को भी मुझे बता सकते हैं ngTableParams
नकली और अपनी कार्यक्षमता का परीक्षण करने के लिए कैसे
मेरे कोड
चमेली परीक्षण का मामला
describe('Testing Controllers', function() {
describe('Testing WorkController Controller', function() {
var WorkController, $scope;
beforeEach(module('wsd.workstations'));
beforeEach(inject(function($controller, $rootScope) {
$scope = $rootScope.$new();
WorkController = $controller('WorkController', {
$rootScope: $rootScope,
$scope: $scope
});
}));
it('should searchDocuments when searchDocuments() is called', function() {
$scope.searchDocuments();
});
});
});
स्क्रिप्ट नीचे दिए गए के रूप में है
angular.module('wsd', ['restangular', 'ngTable', 'wsd.models', 'wsd.workstations', 'wsd.workperiods', 'ngRoute'])
.config(function(RestangularProvider, $routeProvider) {
RestangularProvider.setBaseUrl('/rest/myuser');
$routeProvider.when('/wd', {
templateUrl: 'main/workstation/main.tpl.html',
controller: 'WorkController',
resolve: {
myWorkDocuments: function(Documents) {
return Documents.getWorkDocuments();
}
}
}).when('/wp', {
templateUrl: 'main/workperiod/main.tpl.html',
controller: 'PeriodController',
resolve: {
myWorkPeriods: function(Periods) {
return Periods.getWorkPeriods();
}
}
}).otherwise({
redirectTo: '/wd'
});
});
कार्य केंद्र/main.js
angular.module('wsd.workstations', [])
.controller('WorkController', function($rootScope, $scope, $filter, ngTableParams)
{
$scope.myValues = [{name: "Moroni", age: 50},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34},
{name: "Tiancum", age: 43},
{name: "Jacob", age: 27},
{name: "Nephi", age: 29},
{name: "Enos", age: 34}];
$scope.tableParams = new ngTableParams({
sorting: {
name: 'asc'
}
}, {
getData: function($defer, params) {
$scope.myValues = $filter('orderBy')($scope.myValues, params.orderBy());
$defer.resolve($scope.myValues);
}
});
$scope.searchDocuments = function()
{
// some other logic
};
});
कोई मिनट परिवर्तन नहीं है .... वास्तव में ng-table को main.js के भीतर परिभाषित किया गया है ............. हमारा बच्चा उस बच्चे है, मैंने एनजी-रूट जोड़ा है और पूर्ण स्क्रिप्ट –
न केवल मजाक कर रहा है मैं एसी कार्यक्षमता का परीक्षण करना चाहता हूं –
मैंने जवाब संपादित किया है। 'एसी कार्यक्षमता' का क्या मतलब है? – kihu