Skip to content

Commit daf7a6f

Browse files
committed
fixed mock and jasmine test to lock issue 3232
1 parent 164ce2a commit daf7a6f

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed
167 KB
Loading
-176 KB
Binary file not shown.

test/image/mocks/gl3d_scatter2d-multiple-colors.json renamed to test/image/mocks/gl2d_scatter2d-multiple-colors.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@
163163
"y": [-1000, 1000, 1000, -1000, 0],
164164
"mode": "markers",
165165
"marker": {
166-
"size": 20
166+
"size": 20,
167+
"color": "red"
167168
}
168169
},
169170
{

test/jasmine/tests/gl2d_pointcloud_test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
'use strict';
22

33
var Plotly = require('@lib/index');
4+
var Lib = require('@src/lib');
5+
var d3 = require('d3');
46

57
// Test utilities
68
var createGraphDiv = require('../assets/create_graph_div');
79
var destroyGraphDiv = require('../assets/destroy_graph_div');
810
var failTest = require('../assets/fail_test');
11+
var delay = require('../assets/delay');
12+
var readPixel = require('../assets/read_pixel');
13+
14+
var multipleScatter2dMock = require('@mocks/gl2d_scatter2d-multiple-colors.json');
915

1016
var plotData = {
1117
'data': [
@@ -186,4 +192,22 @@ describe('pointcloud traces', function() {
186192
.catch(failTest)
187193
.then(done);
188194
});
195+
196+
it('@gl should not change other traces colors', function(done) {
197+
var _mock = Lib.extendDeep({}, multipleScatter2dMock);
198+
Plotly.plot(gd, _mock)
199+
.then(delay(40))
200+
.then(function() {
201+
var canvas = d3.select('.gl-canvas-context').node();
202+
203+
var RGBA = readPixel(canvas, canvas.width / 2 - 1, canvas.height / 2 - 1, 1, 1);
204+
205+
expect(RGBA[0] === 255).toBe(true, 'be red');
206+
expect(RGBA[1] === 0).toBe(true, 'no green');
207+
expect(RGBA[2] === 0).toBe(true, 'no blue');
208+
expect(RGBA[3] === 255).toBe(true, 'no transparent');
209+
})
210+
.catch(failTest)
211+
.then(done);
212+
});
189213
});

0 commit comments

Comments
 (0)