Accept input attributes in any order in unit tests.
Review Request #9344 — Created Nov. 1, 2017 and submitted
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.
Description | From | Last Updated |
---|---|---|
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]')); |
|
|
This can be const instead of let. |
|
-
-
djblets/static/djblets/js/forms/views/tests/conditionSetViewTests.es6.js (Diff revision 1) 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]'));
Change Summary:
Update according to Barrent's comment.
Description: |
|
||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commit: |
|
||||||||||||||||||||||||
Diff: |
Revision 2 (+15 -12) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.
-
-
djblets/static/djblets/js/forms/views/tests/conditionSetViewTests.es6.js (Diff revision 2) This can be
const
instead oflet
.
Change Summary:
let there be const
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+15 -12) |
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.