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

Add number widget and expose user attributes #83

Closed
wants to merge 2 commits into from

Conversation

tellnes
Copy link
Contributor

@tellnes tellnes commented Oct 30, 2013

I can split this into two pull requests, but I did not find it necessary.

@@ -26,11 +26,15 @@ var test_input = function (type) {
test.equals(forms.widgets[type]().formatValue('hello'), expectedValue);

test.strictEqual(forms.widgets[type]().formatValue(false), null);

test.deepEqual(forms.widgets[type]( { min: 1 } ).getUserAttrs(), { min: 1 })
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this test (and the resulting addition of getUserAttrs) necessary? Could you test the generated HTML instead of inspecting the innards of the widget?

I'm hesitant to expose things on components because it inhibits future refactoring.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I did forget to explain why I need this.

I'm not using the HTML generator. I have written a jade file which reads the form object and generates custom html. The reason for this is that I do not want to clutter the routes code with things like classes for css. Also, I did find it much easier to just render the form manualy than trying to tweek the output from the toHTML method.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm hesitant to add support for use cases that aren't supported by this module. Specifically, you can certainly use forms purely for validation, but if you're also using it for rendering, the supported use case is to use only it for rendering.

Having forms work with templating systems, or providing a DOM tree, etc, would be a major feature and rewrite to do properly - and I'd prefer not to add such an important feature piecemeal.

ljharb added a commit that referenced this pull request Mar 12, 2014
@ljharb
Copy link
Collaborator

ljharb commented Mar 12, 2014

I've added the widget. I don't want to expose getUserAttributes at this time. Thanks for the contribution!

@ljharb ljharb closed this Mar 12, 2014
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.

2 participants