]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Fix tests on OSX with retina screen 4619/head
authorandig <cpuidle@gmx.de>
Sat, 5 Aug 2017 14:48:12 +0000 (16:48 +0200)
committerEvert Timberg <evert.timberg+github@gmail.com>
Sat, 5 Aug 2017 14:48:12 +0000 (10:48 -0400)
* Fix retina unit test failures
* Honor config file formatting
* Prevent gulp error on non-zero karma result

.editorconfig
gulpfile.js
test/jasmine.index.js
test/specs/platform.dom.tests.js

index 4e0d877efceb1abcb411828be849eaf1ca46b06b..8cea3b4f020b46fb682fe3511bc4d055b11f8b6e 100644 (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
index 2ae49d77d0579f1a21ef2073987732818798bfbf..bb42ea9d3b8b92f3710f3547ac4a25b090c9043c 100644 (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() {
index 10e2e617704f589219bf46a5d77863eeeeddc282..7e5fd67bee04b8473468cef79516386d0e6aaa8e 100644 (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;
index 4358b9b3521801745f0f240cde04244508651189..d765109c49a493d6b70e1979f6205a9923fd7219 100644 (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);
                });
        });
 });