From 4cdb7f17faa912c9ad71ebdbe964bf1924a76692 Mon Sep 17 00:00:00 2001 From: Eisbehr Date: Wed, 11 Nov 2015 18:13:31 +0100 Subject: [PATCH] fix directive test because of newly used $templateCache --- bower.json | 2 +- karma.conf.js | 7 +++++-- package.json | 2 +- .../directives.controller.directive.spec.js | 11 ++++------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bower.json b/bower.json index 4dbd240..9f7c4c6 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-best-practice", "description": "This is a best practice AngularJS package.", - "version": "0.1.4", + "version": "0.1.5", "homepage": "https://github.com/eisbehr-/angular-best-practice", "authors": [{ "name": "Daniel 'Eisbehr' Kern", diff --git a/karma.conf.js b/karma.conf.js index b960bd8..1e22db4 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -17,6 +17,8 @@ module.exports = function(config) { // app - module definitions first 'app/**/*.module.js', 'app/**/*.js', + // templates + 'app/**/*.html', // tests 'tests/**/*.spec.js' ], @@ -29,7 +31,9 @@ module.exports = function(config) { // pre-process matching files before serving them to the browser // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor - preprocessors: {}, + preprocessors: { + 'app/examples/**/*.html': 'html2js' + }, // test results reporter to use // possible values: 'dots', 'progress' @@ -57,7 +61,6 @@ module.exports = function(config) { browsers: [ 'Chrome', 'Firefox', - //'Safari', 'PhantomJS' ], diff --git a/package.json b/package.json index eab076b..0027833 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-best-practice", - "version": "0.1.4", + "version": "0.1.5", "title": "AngularJS - Best Practice", "description": "This is a best practice AngularJS package.", "homepage": "https://github.com/eisbehr-/angular-best-practice", diff --git a/tests/unit/directives/directives.controller.directive.spec.js b/tests/unit/directives/directives.controller.directive.spec.js index f4e3f90..3718da5 100644 --- a/tests/unit/directives/directives.controller.directive.spec.js +++ b/tests/unit/directives/directives.controller.directive.spec.js @@ -5,18 +5,15 @@ describe("when using controller directive", function() var controller; beforeEach(module("practice.directives")); - beforeEach(inject(function($rootScope, $compile, $httpBackend) { + beforeEach(inject(function($rootScope, $compile) { var element = angular.element(""); - var scope = $rootScope.$new(); + var scope = $rootScope; - $httpBackend.expect("GET", "examples/directives/directives.controller.directive.tpl.html") - .respond(200); $compile(element)(scope); $rootScope.$digest(); - scope = element.isolateScope() || element.scope(); - $httpBackend.flush(); - controller = scope.$$childTail.controller; + + controller = scope.controller; })); it("should have a date", function() {