Skip to content

Validation fix to allow for string numbers #642

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 3 commits into from
Nov 1, 2016

Conversation

snurby7
Copy link
Contributor

@snurby7 snurby7 commented Oct 26, 2016

Pull Requests

Please accompany all pull requests with the following (where appropriate):

@seiyria
Copy link
Owner

seiyria commented Oct 26, 2016

-1. IMO validate your data before passing it in.

@snurby7
Copy link
Contributor Author

snurby7 commented Oct 26, 2016

@seiyria fair enough, (I do agree that it should be cleaned prior). You guys seemed to be open to the PR in #630 so I just wrapped it all up.

@seiyria
Copy link
Owner

seiyria commented Oct 26, 2016

Sorry, some days I'm on autopilot (especially when people put what's essentially a diff in their issue).

It's ultimately up to @rovolution but I think it's reasonable to require that the slider only operate on numbers.

Copy link
Collaborator

@rovolution rovolution left a comment

Choose a reason for hiding this comment

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

Personally, I am ok with this feature (since we did say we would accept a PR for it).

See the feedback in the code for further details.

Also, could you also update the README to reflect that the setValue function takes both string and number arguments? Thanks!

@@ -246,6 +246,14 @@ describe("Public Method Tests", function() {
expect(sliderValue).toBe(valueToSet);
});

it("properly sets the value of the slider when given a string value", function(){
Copy link
Collaborator

@rovolution rovolution Oct 28, 2016

Choose a reason for hiding this comment

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

could you also add a test for when you pass a string value that cannot be properly converted into a number? This should still throw an error

For example:

testSlider.slider("setValue", "yolo");

@snurby7
Copy link
Contributor Author

snurby7 commented Oct 31, 2016

@rovolution added an additional test and updated the readme. I feel as though the test is a little redundant as down in the file a little ways before the range slider tests there's a test "when an invalid value type is passed in" that passes in "a" as the value and throws and error, I can remove it if you feel the same way.

@rovolution
Copy link
Collaborator

rovolution commented Oct 31, 2016

@snurby7 oops just saw that test! Thanks for pointing that out! Yea for sure go ahead and delete the new test then since it would be redundant

@rovolution rovolution merged commit b248130 into seiyria:master Nov 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants