Skip to content
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

Validate dynamic enumerated #1769

Merged
merged 2 commits into from
Jun 8, 2017
Merged

Conversation

etpinard
Copy link
Contributor

@etpinard etpinard commented Jun 8, 2017

to be merged in @alexcjohnson 's #1767

fixes Plotly.validate for axis anchor, overlaying and contraintoward.

- so that attribute that declare possible values as regex
  e.g. axis anchor and overlaying pass `Lib.validate()`
- e.g. axis 'anchor' declare both x and y values, but coerce
  x or y values depending on the container.
- similarly for 'overlaying' and 'contraintoward'
@@ -44,6 +44,20 @@ exports.valObjects = {
if(opts.coerceNumber) v = +v;
if(opts.values.indexOf(v) === -1) propOut.set(dflt);
else propOut.set(v);
},
validateFunction: function(v, opts) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This thing in only called during Lib.validate. We need this so that make enumerated attributes like xaxis.anchor that declare regex work with Lib.validate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh and I should add, I didn't want to add regex support in the (regular) coerceFunction defined above for performance reasons.

@alexcjohnson
Copy link
Collaborator

Looks great! 💃

@etpinard etpinard merged commit 4002fc1 into constrain-domain Jun 8, 2017
@etpinard etpinard deleted the validate-dynamic-enumerated branch June 8, 2017 21:07
@etpinard etpinard added this to the 1.28.0 milestone Jun 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants