Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Additionals: fixed the accept method regex, regex should be escaped#1373
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
That looks decent. Could you add unit tests for this method? Even if they need to be wrapped in a feature detect for |
I tried to create test for it, but I'm not sure how to mock the file input functionality, since JS cannot update the value if the file input... Do you have an idea how to test it? |
You could start with an input of type file, select that from the DOM, then overwrite the <inputtype="file"id="accept-input"> varelement=$("#accept-input")[0];// Assign something here for each assertion, not sure what the right format iselement.files=["myfile.docx"];ok($.validator.method.accept(null,element,"docx"),"something something is valid"); I have no idea what the right format for |
Hmmm, the input property |
Makes sense. Maybe we can mock the DOM element from scratch? Along with the |
I had the same idea.. I will try it :) |
I've just created the tests, the last one is for invalid mime type. I'm not sure if the last one check for |
validator; | ||
// dummy DOM element | ||
input.type = "file"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
You can define these above, its fine to reference a variable defined in the same multi declaration.
Thanks for the update! This is promising, but needs a bit of refactoring and cleanup. |
Yes, you are right, this is raw version, I will clean it up. |
Never noticed the new commits until now - there are no notifications for pushes... reviewing again. |
name: filename, | ||
size: 500001, | ||
type: mimeType | ||
}, fileList = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Add a line break after the comma
Still a few minor issues with the tests. Please let me know when you push new commits, so that I can review them immediately. |
ping@jzaefferer |
Hope thats more clear. I'll be away the next few days, will check again next week. |
Sorry for the delay, I had urgent work to do. ping@jzaefferer |
@jzaefferer did you have a chance to see this? |
Sorry for the delay. Could you rebase this against master? Thanks. |
twolfson commentedJul 22, 2015
@mishal As@jzaefferer requested in#1512, I have squashed/rebased this PR into#1531. Authorship and the original diff should be maintained but now in 1 commit and on top of the latest |
Thanks, closing, please merge#1531 |
Fixes#1243