Skip to content

Commit

Permalink
updated tests and changed all routeparams to stateparams
Browse files Browse the repository at this point in the history
  • Loading branch information
malterb committed Feb 14, 2014
1 parent a60eeab commit cce1475
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
1 change: 1 addition & 0 deletions .jshintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/coverage/**
4 changes: 2 additions & 2 deletions public/js/controllers/articles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

angular.module('mean.articles').controller('ArticlesController', ['$scope', '$routeParams', '$location', 'Global', 'Articles', function ($scope, $routeParams, $location, Global, Articles) {
angular.module('mean.articles').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Global', 'Articles', function ($scope, $stateParams, $location, Global, Articles) {
$scope.global = Global;

$scope.create = function() {
Expand Down Expand Up @@ -52,7 +52,7 @@ angular.module('mean.articles').controller('ArticlesController', ['$scope', '$ro

$scope.findOne = function() {
Articles.get({
articleId: $routeParams.articleId
articleId: $stateParams.articleId
}, function(article) {
$scope.article = article;
});
Expand Down
3 changes: 1 addition & 2 deletions test/karma/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ module.exports = function(config) {
'public/lib/angular-mocks/angular-mocks.js',
'public/lib/angular-cookies/angular-cookies.js',
'public/lib/angular-resource/angular-resource.js',
'public/lib/angular-route/angular-route.js',
'public/lib/angular-ui-router/release/angular-ui-router.js',
'public/lib/angular-bootstrap/ui-bootstrap-tpls.js',
'public/lib/angular-bootstrap/ui-bootstrap.js',
'public/lib/angular-ui-utils/modules/route/route.js',
'public/js/app.js',
'public/js/config.js',
'public/js/directives.js',
Expand Down
8 changes: 4 additions & 4 deletions test/karma/unit/controllers/articles.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,21 @@
var ArticlesController,
scope,
$httpBackend,
$routeParams,
$stateParams,
$location;

// The injector ignores leading and trailing underscores here (i.e. _$httpBackend_).
// This allows us to inject a service but then attach it to a variable
// with the same name as the service.
beforeEach(inject(function($controller, $rootScope, _$location_, _$routeParams_, _$httpBackend_) {
beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_) {

scope = $rootScope.$new();

ArticlesController = $controller('ArticlesController', {
$scope: scope
});

$routeParams = _$routeParams_;
$stateParams = _$stateParams_;

$httpBackend = _$httpBackend_;

Expand Down Expand Up @@ -70,7 +70,7 @@
it('$scope.findOne() should create an array with one article object fetched ' +
'from XHR using a articleId URL parameter', function() {
// fixture URL parament
$routeParams.articleId = '525a8422f6d0f87f0e407a33';
$stateParams.articleId = '525a8422f6d0f87f0e407a33';

// fixture response object
var testArticleData = function() {
Expand Down

0 comments on commit cce1475

Please sign in to comment.