Skip to content

Accept empty transforms #1829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 28, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,13 @@ exports.findArrayAttributes = function(trace) {

for(var i = 0; i < transforms.length; i++) {
var transform = transforms[i];
var module = transform._module;

stack = ['transforms[' + i + ']'];
if(module) {
stack = ['transforms[' + i + ']'];

exports.crawl(transform._module.attributes, callback, 1);
exports.crawl(module.attributes, callback, 1);
}
}
}

Expand Down
31 changes: 31 additions & 0 deletions test/jasmine/tests/transform_multi_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ describe('general transforms:', function() {

var traceIn, traceOut;

it('passes through empty transforms', function() {
traceIn = {
y: [2, 1, 2],
transforms: [{}]
};

traceOut = Plots.supplyTraceDefaults(traceIn, 0, fullLayout);

expect(traceOut.transforms).toEqual([{}]);
});

it('supplyTraceDefaults should supply the transform defaults', function() {
traceIn = {
y: [2, 1, 2],
Expand Down Expand Up @@ -436,6 +447,26 @@ describe('multiple transforms:', function() {

});

describe('invalid transforms', function() {
var gd;

beforeEach(function() {
gd = createGraphDiv();
});

afterEach(destroyGraphDiv);

it('ignores them', function(done) {
Plotly.plot(gd, [{
y: [1, 2, 3],
transforms: [{}]
}]).then(function() {
expect(gd._fullData[0].transforms.length).toEqual(1);
done();
});
});
});

describe('multiple traces with transforms:', function() {
'use strict';

Expand Down