Skip to content

Commit 7d2129c

Browse files
Removed console.logs from tests
1 parent 8b63e38 commit 7d2129c

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

test/jasmine/assets/domain_ref/components.js

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@
1313
var Plotly = require('../../../../lib/index');
1414
var d3 = require('d3');
1515
var pixelCalc = require('../../assets/pixel_calc');
16-
var getSVGElemScreenBBox = require(
17-
'../../assets/get_svg_elem_screen_bbox');
18-
var SVGTools = require(
19-
'../../assets/svg_tools');
16+
var getSVGElemScreenBBox = require('../../assets/get_svg_elem_screen_bbox');
17+
// var SVGTools = require('../../assets/svg_tools');
2018
var Lib = require('../../../../src/lib');
2119
var Axes = require('../../../../src/plots/cartesian/axes');
2220
var axisIds = require('../../../../src/plots/cartesian/axis_ids');
@@ -28,6 +26,19 @@ var testMock = require('./domain_ref_base.json');
2826
// NOTE: this tolerance is in pixels
2927
var EQUALITY_TOLERANCE = 1e-2;
3028

29+
// Make an array from a finite iterable (for environments not having
30+
// Array.from)
31+
function iterToArray(iter) {
32+
var a = [];
33+
do {
34+
var v = iter.next();
35+
// when done is true v.value is undefined
36+
if(v.done) { return a; }
37+
a.push(v.value);
38+
} while(true);
39+
return a;
40+
}
41+
3142
// some made-up values for testing
3243
// NOTE: The pixel values are intentionally set so that 2*pixel is never greater
3344
// than the mock's margin. This is so that annotations are not unintentionally
@@ -492,8 +503,8 @@ function checkAROPosition(gd, aro) {
492503
var aroPathBBox = getSVGElemScreenBBox(aroPath);
493504
var aroBBox = shapeToBBox(gd.layout, aro);
494505
var ret = compareBBoxes(aroBBox, aroPathBBox);
495-
console.log('aroBBox: ' + JSON.stringify(aroBBox));
496-
console.log('aroPathBBox: ' + JSON.stringify(SVGTools.svgRectToObj(aroPathBBox)));
506+
// console.log('aroBBox: ' + JSON.stringify(aroBBox));
507+
// console.log('aroPathBBox: ' + JSON.stringify(SVGTools.svgRectToObj(aroPathBBox)));
497508
return ret;
498509
}
499510

@@ -507,7 +518,7 @@ function testShape(
507518
yaroPos,
508519
aroType
509520
) {
510-
console.log('gd.layout: ', JSON.stringify(gd.layout));
521+
// console.log('gd.layout: ', JSON.stringify(gd.layout));
511522
var aro = {
512523
type: aroType,
513524
line: {
@@ -522,7 +533,7 @@ function testShape(
522533
// change to log axes if need be
523534
logAxisIfAxType(gd.layout, layout, 'x' + xAxNum, xaxisType);
524535
logAxisIfAxType(gd.layout, layout, 'y' + yAxNum, yaxisType);
525-
console.log('layout: ', JSON.stringify(layout));
536+
// console.log('layout: ', JSON.stringify(layout));
526537
return Plotly.relayout(gd, layout)
527538
.then(function(gd) {
528539
return checkAROPosition(gd, aro);
@@ -699,7 +710,7 @@ function comboTestDescriptions(testCombos, desribe) {
699710
}
700711

701712
function annotationTestCombos() {
702-
var testCombos = Array.from(iterable.cartesianProduct([
713+
var testCombos = iterToArray(iterable.cartesianProduct([
703714
axisTypes, axisTypes, axisPairs, aroPositionsX, aroPositionsY, arrowAxis
704715
]));
705716
testCombos = testCombos.map(
@@ -722,7 +733,7 @@ function annotationTestDescriptions() {
722733

723734

724735
function imageTestCombos() {
725-
var testCombos = Array.from(iterable.cartesianProduct(
736+
var testCombos = iterToArray(iterable.cartesianProduct(
726737
[
727738
axisTypes, axisTypes, axisPairs,
728739
// axis reference types are contained in here
@@ -749,7 +760,7 @@ function imageTestDescriptions() {
749760
}
750761

751762
function shapeTestCombos() {
752-
var testCombos = Array.from(iterable.cartesianProduct(
763+
var testCombos = iterToArray(iterable.cartesianProduct(
753764
[
754765
axisTypes, axisTypes, axisPairs,
755766
// axis reference types are contained in here

test/jasmine/tests/domain_ref_interact_test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var delay = require('../assets/delay');
1212
var mouseEvent = require('../assets/mouse_event');
1313
// we have to use drag to move annotations for some reason
1414
var drag = require('../assets/drag');
15-
var SVGTools = require('../assets/svg_tools');
15+
// var SVGTools = require('../assets/svg_tools');
1616

1717
// color of the rectangles
1818
var rectColor1 = 'rgb(10, 20, 30)';
@@ -24,17 +24,17 @@ var arrowColor2 = 'rgb(231, 200, 200)';
2424

2525
var DELAY_TIME = 10;
2626

27-
function svgRectToJSON(svgrect) {
28-
return JSON.stringify(SVGTools.svgRectToObj(svgrect));
29-
}
27+
// function svgRectToJSON(svgrect) {
28+
// return JSON.stringify(SVGTools.svgRectToObj(svgrect));
29+
// }
3030

3131
function checkBBox(bboxBefore, bboxAfter, moveX, moveY) {
3232
// We print out the objects for sanity, because sometimes Jasmine says a
3333
// test passed when it actually did nothing!
34-
console.log('bboxBefore', svgRectToJSON(bboxBefore));
35-
console.log('bboxAfter', svgRectToJSON(bboxAfter));
36-
console.log('moveX', moveX);
37-
console.log('moveY', moveY);
34+
// console.log('bboxBefore', svgRectToJSON(bboxBefore));
35+
// console.log('bboxAfter', svgRectToJSON(bboxAfter));
36+
// console.log('moveX', moveX);
37+
// console.log('moveY', moveY);
3838
expect(bboxAfter.x).toBeCloseTo(bboxBefore.x + moveX, 2);
3939
expect(bboxAfter.y).toBeCloseTo(bboxBefore.y + moveY, 2);
4040
}
@@ -84,7 +84,7 @@ function testAnnotationMoveLabel(objectColor, moveX, moveY) {
8484
pos0: dragPos0(bboxBefore)
8585
};
8686
optLabelDrag.dpos = [moveX, moveY];
87-
console.log('optLabelDrag', optLabelDrag);
87+
// console.log('optLabelDrag', optLabelDrag);
8888
// drag the label, this will make the arrow rotate around the arrowhead
8989
return (new Promise(function(resolve) {
9090
drag(optLabelDrag); resolve();
@@ -115,7 +115,7 @@ function testAnnotationMoveWhole(objectColor, arrowColor, moveX, moveY, corner)
115115
pos0: dragPos0(arrowBBoxBefore, corner)
116116
};
117117
optArrowDrag.dpos = [moveX, moveY];
118-
console.log('optArrowDrag', optArrowDrag);
118+
// console.log('optArrowDrag', optArrowDrag);
119119
// drag the whole annotation
120120
(new Promise(function(resolve) {
121121
drag(optArrowDrag); resolve();

test/jasmine/tests/domain_ref_test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function makeTests(component, filter) {
2525
});
2626
descriptions.forEach(function(d, i) {
2727
it(d, function(done) {
28-
console.log('testing ' + d);
28+
// console.log('testing ' + d);
2929
gd.id = 'graph-' + i;
3030
tests[i](function(v) {
3131
expect(v).toBe(true);

0 commit comments

Comments
 (0)