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]')); |
brennie | |
This can be const instead of let. |
david |
- Change Summary:
-
Update according to Barrent's comment.
- Description:
-
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. ~ Apply a simple regex replace to correct the order by putting type
~ Check the tag name and attributes individually instead.
- first and have the tests pass. - Commit:
-
67ab0ba74aeadb69263b0a440c58e3f3f3c267efbd65106d27aa4dae5cde133b63305b230d88b6f3
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.