Accept input attributes in any order in unit tests.

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

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
Review request changed

Change Summary:

let there be const

Commit:

-bd65106d27aa4dae5cde133b63305b230d88b6f3
+8ad0bc305a39d9f5d717aac29142f607a9e0438a

Diff:

Revision 3 (+15 -12)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
Erik Johansson
  1. 
      
  2. Any more comments on this?
  3. 
      
Loading...