File tree Expand file tree Collapse file tree 3 files changed +79
-1
lines changed Expand file tree Collapse file tree 3 files changed +79
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,22 @@ public function containsOptions(...$attributes): self
2424        return  $ this  ;
2525    }
2626
27+     public  function  containsOptgroup (mixed  $ attributes ): self 
28+     {
29+         $ this  ->contains ('optgroup ' , $ attributes );
30+ 
31+         return  $ this  ;
32+     }
33+ 
34+     public  function  containsOptgroups (...$ attributes ): self 
35+     {
36+         foreach  ($ attributes  as  $ attribute ) {
37+             $ this  ->containsOptgroup ($ attribute );
38+         }
39+ 
40+         return  $ this  ;
41+     }
42+ 
2743    public  function  hasValue ($ value ): self 
2844    {
2945        Assert::assertNotNull (
Original file line number Diff line number Diff line change 196196        })->assertOk ();
197197});
198198
199+ it ('can parse a select with optgroups ' , function  () {
200+     $ this  ->get ('form ' )
201+         ->assertFormExists ('#form2 ' , function  (AssertForm   $ form ) {
202+             $ form ->findSelect ('select:nth-of-type(3) ' , function  (AssertSelect   $ selectAssert ) {
203+                 $ selectAssert ->has ('name ' , 'things ' )
204+                     ->containsOptgroup ([
205+                         'label '  => 'Animals ' ,
206+                     ])
207+                     ->containsOptgroups (
208+                         [
209+                             'label '  => 'Vegetables ' ,
210+                             'x-data '  => 'none ' ,
211+                         ],
212+                         [
213+                             'label '  => 'Minerals ' ,
214+                         ]
215+                     )
216+                     ->containsOptions (
217+                         [
218+                             'value '  => 'dog ' ,
219+                             'text '  => 'Dog ' ,
220+                         ],
221+                         [
222+                             'value '  => 'cat ' ,
223+                             'text '  => 'Cat ' ,
224+                         ],
225+                         [
226+                             'value '  => 'carrot ' ,
227+                             'text '  => 'Carrot ' ,
228+                         ],
229+                         [
230+                             'value '  => 'onion ' ,
231+                             'text '  => 'Onion ' ,
232+                         ],
233+                         [
234+                             'value '  => 'calcium ' ,
235+                             'text '  => 'Calcium ' ,
236+                         ],
237+                         [
238+                             'value '  => 'zinc ' ,
239+                             'text '  => 'Zinc ' ,
240+                         ],
241+                     );
242+             });
243+         })->assertOk ();
244+ });
245+ 
199246it ('can parse a select with options functional ' , function  () {
200247    $ this  ->get ('form ' )
201248        ->assertFormExists ('#form2 ' , function  (AssertForm   $ form ) {
Original file line number Diff line number Diff line change 3232            @endforeach 
3333        </select >
3434
35+         <select  name =" things"  >
36+             <optgroup  label =" Animals"  >
37+                 <option  value =" dog"  >Dog</option >
38+                 <option  value =" cat"  >Cat</option >
39+             </optgroup >
40+             <optgroup  label =" Vegetables"   x-data =" none"  >
41+                 <option  value =" carrot"  >Carrot</option >
42+                 <option  value =" onion"  >Onion</option >
43+             </optgroup >
44+             <optgroup  label =" Minerals"  >
45+                 <option  value =" calcium"  >Calcium</option >
46+                 <option  value =" zinc"  >Zinc</option >
47+             </optgroup >
48+         </select >
49+ 
3550        <input  list =" skills"   name =" skill"   value =" PHP"  >
3651        <datalist  id =" skills"  >
3752            <option  value =" PHP"  ></option >
4257        <button  type =" submit"  ></button >
4358    </form >
4459    <input  type =" text"   name =" outside"  >
45- </div >
60+ </div >
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments