Skip to content

Commit

Permalink
chore(tests): Run tests with PhantomJS 2
Browse files Browse the repository at this point in the history
This fixes the test failure with AngularJS 1.5 which is not compatible
with PhantomJS 1: angular/angular.js#13794

BREAKING CHANGES: The minimal AngularJS version is now 1.2.x. The
branches 1.0.x et 1.1.x are no longer supported.
Closes #135
  • Loading branch information
ncuillery committed Apr 9, 2016
1 parent 0c8aab6 commit f19446c
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 28 deletions.
14 changes: 9 additions & 5 deletions Gruntfile.js
Expand Up @@ -219,10 +219,13 @@ module.exports = function (grunt) {
},
shell: {
testMinimal: {
command: 'bower install angular#=1.0.8 angular-mocks#=1.0.8 angular-sanitize#=1.0.8 angular-ui-router#=0.2.0 --config.directory=. --config.cwd=testDependencies'
command: 'bower install angular#=1.2.29 angular-mocks#=1.2.29 angular-sanitize#=1.2.29 angular-ui-router#=0.2.18 --config.directory=. --config.cwd=testDependencies'
},
test1dot2: {
command: 'bower install angular#=1.2.18 angular-mocks#=1.2.18 angular-sanitize#=1.2.18 angular-ui-router#=0.2.15 --config.directory=. --config.cwd=testDependencies'
test1dot3: {
command: 'bower install angular#=1.3.20 angular-mocks#=1.3.20 angular-sanitize#=1.3.20 angular-ui-router#=0.2.18 --config.directory=. --config.cwd=testDependencies'
},
test1dot4: {
command: 'bower install angular#=1.4.10 angular-mocks#=1.4.10 angular-sanitize#=1.4.10 angular-ui-router#=0.2.18 --config.directory=. --config.cwd=testDependencies'
},
testLatest: {
command: 'bower install angular angular-mocks angular-sanitize angular-ui-router --config.directory=. --config.cwd=testDependencies'
Expand Down Expand Up @@ -250,9 +253,10 @@ module.exports = function (grunt) {

grunt.registerTask('meteor-publish', ['exec:meteor-init', 'exec:meteor-publish']);

grunt.registerTask('test', ['jshint', 'testMin', 'test1dot2', 'testLatest']);
grunt.registerTask('test', ['jshint', 'testMin', 'test1dot3', 'testLatest']);
grunt.registerTask('testMin', ['clean:test', 'shell:testMinimal', 'karma']);
grunt.registerTask('test1dot2', ['clean:test', 'shell:test1dot2', 'karma']);
grunt.registerTask('test1dot3', ['clean:test', 'shell:test1dot3', 'karma']);
grunt.registerTask('test1dot4', ['clean:test', 'shell:test1dot4', 'karma']);
grunt.registerTask('testLatest', ['clean:test', 'shell:testLatest', 'karma']);

grunt.registerTask('default', ['test', 'concat:dev', 'uglify:dev']);
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -20,7 +20,7 @@
"README.md"
],
"dependencies": {
"angular": ">=1.0.8",
"angular": ">=1.2.0",
"angular-ui-router": ">=0.2.0"
},
"devDependencies": {
Expand Down
17 changes: 9 additions & 8 deletions dist/angular-breadcrumb.js
@@ -1,6 +1,6 @@
/*! angular-breadcrumb - v0.4.0-dev-2015-08-07
/*! angular-breadcrumb - v0.4.1-dev-2016-04-09
* http://ncuillery.github.io/angular-breadcrumb
* Copyright (c) 2015 Nicolas Cuillery; Licensed MIT */
* Copyright (c) 2016 Nicolas Cuillery; Licensed MIT */

(function (window, angular, undefined) {
'use strict';
Expand Down Expand Up @@ -152,6 +152,7 @@ function $Breadcrumb() {

var getExpression = function(interpolationFunction) {
if(interpolationFunction.expressions) {
// Workaround for Angular 1.2.x
return interpolationFunction.expressions;
} else {
var expressions = [];
Expand Down Expand Up @@ -210,7 +211,7 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
var renderBreadcrumb = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
Expand Down Expand Up @@ -260,7 +261,7 @@ function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
Expand Down Expand Up @@ -306,13 +307,13 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
if(template) {
cElement.html(template);
}

var separator = cElement.attr(cAttrs.$attr.ncyBreadcrumbTextSeparator) || ' / ';

return {
post: function postLink(scope) {
var labelWatchers = [];

var registerWatchersText = function(labelWatcherArray, interpolationFunction, viewScope) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function(newValue, oldValue) {
Expand All @@ -327,7 +328,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
Expand All @@ -341,7 +342,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
combinedLabels.push(step.name);
}
});

scope.ncyBreadcrumbChain = combinedLabels.join(separator);
};

Expand Down
4 changes: 2 additions & 2 deletions dist/angular-breadcrumb.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 13 additions & 6 deletions package.json
Expand Up @@ -41,15 +41,22 @@
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-watch": "~0.4.0",
"grunt-conventional-changelog": "~1.1.0",
"grunt-karma": "~0.6.2",
"grunt-exec": "^0.4.6",
"grunt-karma": "~0.12.2",
"grunt-open": "~0.2.0",
"grunt-shell": "~0.7.0",
"grunt-text-replace": "^0.3.12",
"karma": "~0.10.2",
"karma-coverage": "~0.1.0",
"karma-story-reporter": "~0.2.2",
"grunt-exec": "^0.4.6",
"jasmine-core": "^2.4.1",
"karma": "^0.13.22",
"karma-coverage": "~0.1.5",
"karma-jasmine": "^0.3.8",
"karma-phantomjs-launcher": "^1.0.0",
"karma-story-reporter": "^0.3.1",
"phantomjs-prebuilt": "^2.1.7",
"spacejam": "^1.1.1"
},
"keywords": ["angular", "breadcrumb"]
"keywords": [
"angular",
"breadcrumb"
]
}
13 changes: 7 additions & 6 deletions src/angular-breadcrumb.js
Expand Up @@ -147,6 +147,7 @@ function $Breadcrumb() {

var getExpression = function(interpolationFunction) {
if(interpolationFunction.expressions) {
// Workaround for Angular 1.2.x
return interpolationFunction.expressions;
} else {
var expressions = [];
Expand Down Expand Up @@ -205,7 +206,7 @@ function BreadcrumbDirective($interpolate, $breadcrumb, $rootScope) {
var renderBreadcrumb = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
scope.steps = $breadcrumb.getStatesChain();
angular.forEach(scope.steps, function (step) {
Expand Down Expand Up @@ -255,7 +256,7 @@ function BreadcrumbLastDirective($interpolate, $breadcrumb, $rootScope) {
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
var lastStep = $breadcrumb.getLastStep();
if(lastStep) {
Expand Down Expand Up @@ -301,13 +302,13 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
if(template) {
cElement.html(template);
}

var separator = cElement.attr(cAttrs.$attr.ncyBreadcrumbTextSeparator) || ' / ';

return {
post: function postLink(scope) {
var labelWatchers = [];

var registerWatchersText = function(labelWatcherArray, interpolationFunction, viewScope) {
angular.forEach(getExpression(interpolationFunction), function(expression) {
var watcher = viewScope.$watch(expression, function(newValue, oldValue) {
Expand All @@ -322,7 +323,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
var renderLabel = function() {
deregisterWatchers(labelWatchers);
labelWatchers = [];

var viewScope = $breadcrumb.$getLastViewScope();
var steps = $breadcrumb.getStatesChain();
var combinedLabels = [];
Expand All @@ -336,7 +337,7 @@ function BreadcrumbTextDirective($interpolate, $breadcrumb, $rootScope) {
combinedLabels.push(step.name);
}
});

scope.ncyBreadcrumbChain = combinedLabels.join(separator);
};

Expand Down

0 comments on commit f19446c

Please sign in to comment.