Skip to content

Commit efb9bdf

Browse files
author
Dan Bucholtz
committed
fix(navigation) ionicHistory infinite loop when linking tabs #3932
1 parent f54dbb9 commit efb9bdf

File tree

5 files changed

+338
-51
lines changed

5 files changed

+338
-51
lines changed

Diff for: config/gulp-tasks/test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,16 @@ var uuid = require('node-uuid');
1010

1111
var projectRoot = path.resolve(__dirname, '../..');
1212

13-
var karmaConf = require('../karma.conf.js');
1413
var karmaSauceConf = require('../karma-sauce.conf.js');
1514

1615
module.exports = function(gulp, argv) {
1716

17+
var includeCodeCoverage = true;
18+
if ( argv.skipCoverage ){
19+
includeCodeCoverage = false;
20+
}
21+
var karmaConf = require('../karma.conf')(includeCodeCoverage);
22+
1823
/*
1924
* Connect to Saucelabs
2025
*/

Diff for: config/karma.conf.js

+50-45
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
var buildConfig = require('./build.config.js');
22
var path = require('canonical-path');
33

4-
module.exports = {
5-
files: [
4+
module.exports = function(includeCodeCoverage){
5+
console.log("in the function");
6+
var config = {};
7+
8+
config.files = [
69
// Include jQuery only for testing convience (lots of DOM checking for unit tests on directives)
710
'http://codeorigin.jquery.com/jquery-1.10.2.min.js',
811
'config/lib/js/angular/angular.js',
@@ -12,47 +15,49 @@ module.exports = {
1215
'config/lib/js/angular-ui/angular-ui-router.js',
1316
'config/lib/testutil.js'
1417
]
15-
.concat(buildConfig.ionicFiles)
16-
.concat(buildConfig.angularIonicFiles)
17-
.concat('test/unit/**/*.js'),
18-
19-
exclude: [
20-
'js/ext/angular/test/dom-trace.js'
21-
],
22-
preprocessors: {
23-
'js/**/*.js': 'coverage'
24-
},
25-
frameworks: ['jasmine'],
26-
reporters: ['progress', 'coverage'],
27-
port: 9876,
28-
colors: true,
29-
// possible values: 'OFF', 'ERROR', 'WARN', 'INFO', 'DEBUG'
30-
logLevel: 'INFO',
31-
autoWatch: true,
32-
captureTimeout: 60000,
33-
singleRun: false,
34-
mochaReporter: {
18+
.concat(buildConfig.ionicFiles)
19+
.concat(buildConfig.angularIonicFiles)
20+
.concat('test/unit/**/*.js');
21+
22+
config.exclude = ['js/ext/angular/test/dom-trace.js'];
23+
24+
config.frameworks = ['jasmine'];
25+
26+
config.reporters = ['progress'];
27+
28+
config.port = 9876;
29+
config.colors = true;
30+
config.logLevel = 'INFO';
31+
config.autoWatch = true;
32+
config.captureTimeout = 60000;
33+
config.singleRun = false;
34+
config.mochaReporter = {
3535
output: 'full'
36-
},
37-
coverageReporter: {
38-
reporters: [{
39-
type: 'text'
40-
}, {
41-
type: 'text-summary'
42-
}, {
43-
type: 'cobertura',
44-
file: 'coverage.xml'
45-
}, {
46-
type: 'lcov'
47-
}]
48-
},
49-
// Start these browsers, currently available:
50-
// - Chrome
51-
// - ChromeCanary
52-
// - Firefox
53-
// - Opera (has to be installed with `npm install karma-opera-launcher`)
54-
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
55-
// - PhantomJS
56-
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
57-
browsers: ['Chrome']
58-
};
36+
};
37+
38+
config.browsers = ['Chrome'];
39+
40+
if ( includeCodeCoverage ){
41+
config.preprocessors = {'js/**/*.js': 'coverage'};
42+
config.reporters.push('coverage');
43+
config.coverageReporter = {
44+
reporters: [
45+
{
46+
type: 'text'
47+
},
48+
{
49+
type: 'text-summary'
50+
},
51+
{
52+
type: 'cobertura',
53+
file: 'coverage.xml'
54+
},
55+
{
56+
type: 'lcov'
57+
}
58+
]
59+
};
60+
}
61+
62+
return config;
63+
}

Diff for: js/angular/service/history.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
325325
direction = DIRECTION_FORWARD;
326326

327327
} else if (currentView.historyId !== hist.historyId) {
328+
// DB: this is a new view in a different tab
328329
direction = DIRECTION_ENTER;
329330

330331
tmp = getHistoryById(currentView.historyId);
@@ -354,7 +355,7 @@ function($rootScope, $state, $location, $window, $timeout, $ionicViewSwitcher, $
354355
viewId: viewId,
355356
index: hist.stack.length,
356357
historyId: hist.historyId,
357-
backViewId: (currentView && currentView.viewId ? currentView.viewId : null),
358+
backViewId: (currentView && currentView.viewId && (currentView.historyId === hist.historyId || currentView.historyId === hist.parentHistoryId) ? currentView.viewId : null),
358359
forwardViewId: null,
359360
stateId: currentStateId,
360361
stateName: this.currentStateName(),

0 commit comments

Comments
 (0)