Skip to content

Commit

Permalink
Merge branch 'master' into ts-router
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon authored Oct 15, 2018
2 parents d0ac8c4 + 3d7c24d commit 454067b
Show file tree
Hide file tree
Showing 13 changed files with 297 additions and 128 deletions.
70 changes: 70 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Defaults for all jobs

defaults: &defaults
working_directory: ~/repo
docker:
- image: aureliaeffect/circleci-v1:latest

# Variables
var_1: &cache_key aurelia-{{ .Branch }}-{{ checksum "package.json" }}{{ checksum "package-lock.json" }}

version: 2
jobs:
install:
<<: *defaults
steps:
- checkout
- run: npm ci
- run: jspm install
- run: git checkout -- package.json
- save_cache:
key: *cache_key
paths:
- node_modules
- jspm_packages

build:
<<: *defaults
steps:
- checkout
- restore_cache:
key: *cache_key
- run: gulp build
- store_artifacts:
path: ./dist

unit_tests:
<<: *defaults
steps:
- checkout
- restore_cache:
key: *cache_key
- run: gulp cover
- run: codecov -f ./build/reports/coverage/coverage-final.json
- store_test_results:
path: ./build/reports/coverage
- store_artifacts:
path: ./build/reports/coverage

lint:
<<: *defaults
steps:
- checkout
- restore_cache:
key: *cache_key
- run: gulp lint

workflows:
version: 2
default_workflow:
jobs:
- install
- build:
requires:
- install
- unit_tests:
requires:
- install
- lint:
requires:
- install
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-router",
"version": "1.6.2",
"version": "1.6.3",
"description": "A powerful client-side router.",
"keywords": [
"aurelia",
Expand Down
23 changes: 23 additions & 0 deletions build/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,26 @@ gulp.task('coveralls', ['test'], function (done) {
gulp.src('build/reports/coverage/lcov/report-lcovonly.txt')
.pipe(coveralls());
});


/**
* Run test once with code coverage and exit
*/
gulp.task('cover', function (done) {
new karma.Server({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true,
reporters: ['progress', 'coverage'],
preprocessors: {
'test/**/*.js': ['babel'],
'src/**/*.js': ['babel', 'coverage']
},
coverageReporter: {
dir: 'build/reports/coverage',
reporters: [
{ type: 'html', subdir: 'report-html' },
{ type: 'json', subdir: '.', file: 'coverage-final.json' }
]
}
}, done).start();
});
12 changes: 10 additions & 2 deletions dist/amd/aurelia-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
this.isNavigatingRefresh = false;
this.isNavigatingForward = false;
this.isNavigatingBack = false;
this.couldDeactivate = false;
this.navigation = [];
this.currentInstruction = null;
this.viewPortDefaults = {};
Expand Down Expand Up @@ -1322,6 +1323,8 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
}
}

navigationInstruction.router.couldDeactivate = true;

return next();
}

Expand Down Expand Up @@ -1678,9 +1681,13 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
PipelineProvider.prototype.createPipeline = function createPipeline() {
var _this9 = this;

var useCanDeactivateStep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

var pipeline = new Pipeline();
this.steps.forEach(function (step) {
return pipeline.addStep(_this9.container.get(step));
if (useCanDeactivateStep || step !== CanDeactivatePreviousStep) {
pipeline.addStep(_this9.container.get(step));
}
});
return pipeline;
};
Expand Down Expand Up @@ -1875,7 +1882,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
throw new Error('Maximum navigation attempts exceeded. Giving up.');
}

var pipeline = _this14.pipelineProvider.createPipeline();
var pipeline = _this14.pipelineProvider.createPipeline(!_this14.couldDeactivate);

return pipeline.run(instruction).then(function (result) {
return processResult(instruction, result, instructionCount, _this14);
Expand Down Expand Up @@ -1953,6 +1960,7 @@ define(['exports', 'aurelia-logging', 'aurelia-route-recognizer', 'aurelia-depen
router.isNavigatingRefresh = false;
router.isNavigatingForward = false;
router.isNavigatingBack = false;
router.couldDeactivate = false;

var eventName = void 0;

Expand Down
Loading

0 comments on commit 454067b

Please sign in to comment.