Skip to content

Add identity _fullInput refs to fullTrace #1072

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
Oct 25, 2016
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
5 changes: 5 additions & 0 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,11 @@ plots.supplyDataDefaults = function(dataIn, dataOut, layout, fullLayout) {
}
}
else {

// add identify refs for consistency with transformed traces
fullTrace._fullInput = fullTrace;
fullTrace._expandedInput = fullTrace;

pushModule(fullTrace);
}
}
Expand Down
27 changes: 27 additions & 0 deletions test/jasmine/tests/plots_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ describe('Test Plots', function() {
expect(gd._fullLayout.yaxis._m)
.not.toBe(oldFullLayout.yaxis._m, '(set during ax.setScale');
});

it('should include the correct reference to user data', function() {
var trace0 = { y: [1, 2, 3] };
var trace1 = { y: [5, 2, 3] };

var data = [trace0, trace1];
var gd = { data: data };

Plots.supplyDefaults(gd);

expect(gd.data).toBe(data);

expect(gd._fullData[0].index).toEqual(0);
expect(gd._fullData[1].index).toEqual(1);

expect(gd._fullData[0]._expandedIndex).toEqual(0);
expect(gd._fullData[1]._expandedIndex).toEqual(1);

expect(gd._fullData[0]._input).toBe(trace0);
expect(gd._fullData[1]._input).toBe(trace1);

expect(gd._fullData[0]._fullInput).toBe(gd._fullData[0]);
expect(gd._fullData[1]._fullInput).toBe(gd._fullData[1]);

expect(gd._fullData[0]._expandedInput).toBe(gd._fullData[0]);
expect(gd._fullData[1]._expandedInput).toBe(gd._fullData[1]);
});
});

describe('Plots.supplyLayoutGlobalDefaults should', function() {
Expand Down