Feature Idea

7 views
Skip to first unread message

Mike Tonks

unread,
Jan 11, 2012, 8:32:04 AM1/11/12
to www-mecha...@googlegroups.com
Hi,

I just realised that $mech->submit_form_ok (and $mech->submit_form)
does not use strict mode, i.e. it let's me fill in fields that don't
actually exist on the form.

This means some of my test are passing when they should not.

If I were to submit a patch to submit_form method to accept strict =>
1 as a parameter would it be likely to be accepted? Or is that a bad
idea for some reason?

looks like it would go something like:


$self->set_fields( %{$fields} ) if $fields;

+ $self->current_form->strict(1) if $args{strict};

Is there any other way to turn on strict form checking that I've
missed. Doing it once globally might work well, rather than on each
call.

cheers,

mike

Mike Tonks

unread,
Jan 11, 2012, 8:51:44 AM1/11/12
to www-mecha...@googlegroups.com
Working patch:

1840c1840
< if ( !/^(form_(number|name|fields|id)|(with_)?fields|button|x|y)$/ ) {
---
> if ( !/^(form_(number|name|fields|id)|(with_)?fields|button|x|y|strict)$/ ) {
1876a1877,1878


> $self->current_form->strict(1) if $args{strict};
>

NB: $self->current_form->strict(1) needs to come *before* set_fields

Reply all
Reply to author
Forward
0 new messages