Fix tests on OSX with retina screen

* Fix retina unit test failures
* Honor config file formatting
* Prevent gulp error on non-zero karma result
This commit is contained in:
andig 2017-08-05 16:48:12 +02:00 committed by Evert Timberg
parent 9ef5cc72f6
commit 8dca88c7d5
4 changed files with 20 additions and 3 deletions

View File

@ -8,3 +8,11 @@ end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
[gulpfile.js]
indent_style = space
indent_size = 2
[*.yml]
indent_style = space
indent_size = 2

View File

@ -188,7 +188,12 @@ function unittestTask(done) {
args: {
coverage: !!argv.coverage
}
}, done).start();
},
// https://github.com/karma-runner/gulp-karma/issues/18
function(error) {
error = error ? new Error('Karma returned with the error code: ' + error) : undefined;
done(error);
}).start();
}
function librarySizeTask() {

View File

@ -22,6 +22,10 @@ var utils = require('./jasmine.utils');
return new Context();
}
// force ratio=1 for tests on high-res/retina devices
// fixes https://github.com/chartjs/Chart.js/issues/4515
window.devicePixelRatio = 1;
window.acquireChart = acquireChart;
window.releaseChart = releaseChart;
window.waitForResize = utils.waitForResize;

View File

@ -394,8 +394,8 @@ describe('Platform.dom', function() {
expect(notifiedEvent.type).toBe(evt.type);
// Relative Position
expect(notifiedEvent.x).toBe(chart.width / 2);
expect(notifiedEvent.y).toBe(chart.height / 2);
expect(notifiedEvent.x).toBeCloseToPixel(chart.width / 2);
expect(notifiedEvent.y).toBeCloseToPixel(chart.height / 2);
});
});
});