Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Revert "Merge branch 'pr/76' into 0.3.1"
Browse files Browse the repository at this point in the history
This reverts commit cdd6aac, reversing
changes made to a29ec24.
  • Loading branch information
amoshaviv committed May 25, 2014
1 parent cdd6aac commit a7cb2b8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ angular.module('articles').controller('ArticlesController', ['$scope', '$statePa
});
};

$scope.find = function() {
$scope.articles = Articles.query();
};

$scope.findOne = function() {
$scope.article = Articles.get({
articleId: $stateParams.articleId
});
};

$scope.find = function() {
$scope.articles = Articles.query();
};

updateArticleList();
}
]);
15 changes: 6 additions & 9 deletions public/modules/articles/tests/articles.client.controller.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
scope,
$httpBackend,
$stateParams,
$location,
sampleArticles;
$location;

// The $resource service augments the response object with methods for updating and deleting the resource.
// If we were to use the standard toEqual matcher, our tests would fail because the test values would not match
Expand Down Expand Up @@ -51,25 +50,23 @@
});
}));

// Handle controller initialization logic and data fixtures
beforeEach(inject(function(Articles) {
it('$scope.find() should create an array with at least one article object fetched from XHR', inject(function(Articles) {
// Create sample article using the Articles service
var sampleArticle = new Articles({
title: 'An Article about MEAN',
content: 'MEAN rocks!'
});

// Add the sample article to the sampleArticles array
sampleArticles = [sampleArticle];
// Create a sample articles array that includes the new article
var sampleArticles = [sampleArticle];

// Set GET response
$httpBackend.expectGET('articles').respond(sampleArticles);

// Run the controller initialization functionality
// Run controller functionality
scope.find();
$httpBackend.flush();
}));

it('should update the list of Articles on initialization', inject(function(Articles) {
// Test scope value
expect(scope.articles).toEqualData(sampleArticles);
}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<section data-ng-controller="ArticlesController">
<section data-ng-controller="ArticlesController" data-ng-init="find()">
<div class="page-header">
<h1>Articles</h1>
</div>
Expand Down

0 comments on commit a7cb2b8

Please sign in to comment.