[英]How can I “uncheck” a checkbox field with Laravel Application testing?
In Laravel 5.1 according to http://laravel.com/docs/5.1/testing#interacting-with-your-application I can use: 在Laravel 5.1中根据http://laravel.com/docs/5.1/testing#interacting-with-your-application我可以使用:
$this->visit('/register')
->type('Taylor', 'name')
->check('terms')
->press('Register')
->seePageIs('/dashboard');
But is there any way to uncheck a checkbox? 但有没有办法取消选中复选框? (No matter if it is checked or not).
(无论是否检查)。
Thanks 谢谢
You can make use of the underlying DOM crawler (Symfony). 您可以使用底层DOM爬虫(Symfony)。
finally you submit the form 最后你提交表格
$form = $this->getForm('SUBMIT'); $form['single_cb']->untick(); $form['multiple_cb'][0]->untick(); $form['multiple_cb'][1]->tick(); $form['multiple_cb'][2]->tick(); $this->makeRequestUsingForm($form);
你现在也可以使用
$this->uncheck('#my-checkbox');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.