Accept input attributes in any order in unit tests.

Review Request #9344 - Created Nov. 1, 2017 and submitted

Erik Johansson
Djblets
release-0.10.x
4594
8ad0bc3...
djblets
The condition set view tests verified that input tags had the expected
type and name attributes by comparing the generated HTML. But in some
browsers the name attribute appears before the type which failed the
test.

Check the tag name and attributes individually instead.

Unit tests now pass.

  • 0
  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Barret Rennie
  1. 
      
  2. Why not just test the attributes directly? e.g.

    let $input = $value.find('input');
    expect($input.parent.prop('tagName')).toBe('span');
    expect($input.attr('type')).toBe('text');
    expect($input.attr('name')).toBe('my_conditions_value[0]'));
    
  3. 
      
Erik Johansson
Erik Johansson
David Trowbridge
  1. 
      
  2. This can be const instead of let.

  3. 
      
Erik Johansson
Erik Johansson
  1. 
      
  2. Any more comments on this?
  3. 
      
David Trowbridge
  1. Ship It!
  2. 
      
Erik Johansson
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-1.0.x (8525f39)
Loading...