8000 Bring back roles with value object by archmoj · Pull Request #5432 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Bring back roles with value object #5432

8000
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 7 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
adjustments to bring object role only
  • Loading branch information
archmoj committed Jan 22, 2021
commit 4efc5aec1f166ebf5afb09ba9a45d5281a3cef37
1 change: 0 additions & 1 deletion src/components/colorbar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = overrideAll({
// TODO: only right is supported currently
// orient: {
// valType: 'enumerated',
// role: 'info',
// values: ['left', 'right', 'top', 'bottom'],
// dflt: 'right',
// description: [
Expand Down
9 changes: 2 additions & 7 deletions src/plot_api/plot_schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -621,13 +621,8 @@ function mergeValTypeAndRole(attrs) {

function callback(attr, attrName, attrs) {
if(exports.isValObject(attr)) {
if(attr.valType === 'data_array') {
// all 'data_array' attrs have role 'data'
attr.role = 'data';
// all 'data_array' attrs have a corresponding 'src' attr
attrs[attrName + 'src'] = makeSrcAttr(attrName);
} else if(attr.arrayOk === true) {
// all 'arrayOk' attrs have a corresponding 'src' attr
if(attr.arrayOk === true || attr.valType === 'data_array') {
// all 'arrayOk' and 'data_array' attrs have a corresponding 'src' attr
attrs[attrName + 'src'] = makeSrcAttr(attrName);
}
} else if(isPlainObject(attr)) {
Expand Down
1 change: 0 additions & 1 deletion src/traces/barpolar/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ module.exports = {

// orientation: {
// valType: 'enumerated',
// role: 'info',
// values: ['radial', 'angular'],
// editType: 'calc+clearAxisTypes',
// description: 'Sets the orientation of the bars.'
Expand Down
1 change: 0 additions & 1 deletion src/traces/streamtube/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ var attrs = {
// valType: 'enumerated',
// values: ['scaled', 'absolute', 'fixed'],
// dflt: 'scaled',
// role: 'info',
// editType: 'calc',
// description: [
// 'Sets the mode by which the streamtubes are sized.'
Expand Down
1 change: 1 addition & 0 deletions tasks/compress_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = function() {
.replace(makeJoinedArrayRegex('description'), '')
.replace(makeArrayRegex('requiredOpts'), '')
.replace(makeArrayRegex('otherOpts'), '')
.replace(makeStringRegex('role'), '')
.replace(makeStringRegex('hrName'), '')
);
done();
Expand Down
10 changes: 5 additions & 5 deletions test/jasmine/bundle_tests/plotschema_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('plot schema', function() {
var isPlainObject = Lib.isPlainObject;

var VALTYPES = Object.keys(valObjects);
var ROLES = ['info', 'style', 'data'];
var deprecatedRoles = ['info', 'style', 'data'];
var editType = plotSchema.defs.editType;

function assertTraceSchema(callback) {
Expand Down Expand Up @@ -73,11 +73,11 @@ describe('plot schema', function() {
);
});

it('all attributes should only have valid `role`', function() {
it('all attributes should not have valid a deprecated `role`', function() {
assertPlotSchema(
function(attr) {
if(isValObject(attr)) {
expect(ROLES.indexOf(attr.role) !== -1).toBe(true, attr);
expect(deprecatedRoles.indexOf(attr.role) === -1).toBe(true, attr);
}
}
);
Expand Down Expand Up @@ -223,7 +223,7 @@ describe('plot schema', function() {
);
});

it('deprecated attributes should have a `valType` and `role`', function() {
it('deprecated attributes should have a `valType` and not any deprecated roles', function() {
var DEPRECATED = '_deprecated';

assertPlotSchema(
Expand All @@ -234,7 +234,7 @@ describe('plot schema', function() {

expect(VALTYPES.indexOf(dAttr.valType) !== -1)
.toBe(true, attrString + ': ' + dAttrName);
expect(ROLES.indexOf(dAttr.role) !== -1)
expect(deprecatedRoles.indexOf(dAttr.role) === -1)
.toBe(true, attrString + ': ' + dAttrName);
});
}
Expand Down
6 changes: 2 additions & 4 deletions test/jasmine/tests/plot_api_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2877,8 +2877,7 @@ describe('plot_api edit_types', function() {

editTypes.update(flags, {
valType: 'boolean',
dflt: true,
role: 'style'
dflt: true
});

expect(flags).toEqual({calc: false, style: true});
Expand All @@ -2898,8 +2897,7 @@ describe('plot_api edit_types', function() {
editTypes.update(flags, {
editType: 'calc+style',
valType: 'number',
dflt: 1,
role: 'style'
dflt: 1
});

expect(flags).toEqual({calc: true, legend: true, style: true});
Expand Down
0