From a7cb2b8dbc161da1c798ad88eb64f29199b09047 Mon Sep 17 00:00:00 2001 From: Amos Haviv Date: Mon, 26 May 2014 00:55:18 +0300 Subject: [PATCH] Revert "Merge branch 'pr/76' into 0.3.1" This reverts commit cdd6aacd09df8a9af5e91ea8457053c2ab9bbe92, reversing changes made to a29ec2435fa0a6e8d0f3fb85fdbcb63debde419c. --- .../controllers/articles.client.controller.js | 10 ++++------ .../tests/articles.client.controller.test.js | 15 ++++++--------- .../articles/views/list-articles.client.view.html | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/public/modules/articles/controllers/articles.client.controller.js b/public/modules/articles/controllers/articles.client.controller.js index a6422a42fa..02ab64c908 100644 --- a/public/modules/articles/controllers/articles.client.controller.js +++ b/public/modules/articles/controllers/articles.client.controller.js @@ -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(); } ]); \ No newline at end of file diff --git a/public/modules/articles/tests/articles.client.controller.test.js b/public/modules/articles/tests/articles.client.controller.test.js index 4591dbd1b7..7e25c699bb 100644 --- a/public/modules/articles/tests/articles.client.controller.test.js +++ b/public/modules/articles/tests/articles.client.controller.test.js @@ -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 @@ -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); })); diff --git a/public/modules/articles/views/list-articles.client.view.html b/public/modules/articles/views/list-articles.client.view.html index 087c08975e..861ae5b6ba 100644 --- a/public/modules/articles/views/list-articles.client.view.html +++ b/public/modules/articles/views/list-articles.client.view.html @@ -1,4 +1,4 @@ -
+