Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
mishal wants to merge7 commits intojquery-validation:masterfrommishal:file-accept

Conversation

mishal
Copy link
Contributor

Fixes#1243

@jzaefferer
Copy link
Collaborator

That looks decent. Could you add unit tests for this method? Even if they need to be wrapped in a feature detect forelement.files, that would still be a big improvement over no coverage at all.

@mishal
Copy link
ContributorAuthor

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?

@jzaefferer
Copy link
Collaborator

You could start with an input of type file, select that from the DOM, then overwrite thefiles property. Not sure if its writable, but if it is, this might work (not tested):

<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 forfiles andparam are, but I hope this helps. Thanks for looking into it!

@mishal
Copy link
ContributorAuthor

Hmmm, the input propertyfiles is readonly for security reasons.

@jzaefferer
Copy link
Collaborator

Makes sense. Maybe we can mock the DOM element from scratch? Along with thefiles property it needs to be pass thethis.optional() check and respond to$(element).attr("type") with"file".

@mishal
Copy link
ContributorAuthor

I had the same idea.. I will try it :)

@mishal
Copy link
ContributorAuthor

I've just created the tests, the last one is for invalid mime type. I'm not sure if the last one check fordependency-mismatch is ok...

validator;

// dummy DOM element
input.type = "file";
Copy link
Collaborator

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.

@jzaefferer
Copy link
Collaborator

Thanks for the update! This is promising, but needs a bit of refactoring and cleanup.

@mishal
Copy link
ContributorAuthor

Yes, you are right, this is raw version, I will clean it up.

@jzaefferer
Copy link
Collaborator

Never noticed the new commits until now - there are no notifications for pushes... reviewing again.

name: filename,
size: 500001,
type: mimeType
}, fileList = {
Copy link
Collaborator

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

@jzaefferer
Copy link
Collaborator

Still a few minor issues with the tests. Please let me know when you push new commits, so that I can review them immediately.

@mishal
Copy link
ContributorAuthor

ping@jzaefferer

@jzaefferer
Copy link
Collaborator

Hope thats more clear. I'll be away the next few days, will check again next week.

@mishal
Copy link
ContributorAuthor

Sorry for the delay, I had urgent work to do.

ping@jzaefferer

@mishal
Copy link
ContributorAuthor

@jzaefferer did you have a chance to see this?

@jzaefferer
Copy link
Collaborator

Sorry for the delay. Could you rebase this against master? Thanks.

@twolfson
Copy link

@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 latestmaster.

@mishal
Copy link
ContributorAuthor

Thanks, closing, please merge#1531

@mishalmishal closed thisSep 9, 2015
staabm pushed a commit that referenced this pull requestNov 26, 2015
This adds support for types like "application/epub+zip"which contain regex meta characters.Fixes#1243,#1258.Closes#1531,#1373. Refs#1512.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

"accept" validator not working on application/epub+zip mimetype
3 participants
@mishal@jzaefferer@twolfson

[8]ページ先頭

©2009-2025 Movatter.jp