Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / number / number-validity-rangeunderflow.html
blob0e33875ed1a48a9d5da7dd3cf60d3f23e3629105
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description('This test aims to check for rangeUnderflow flag with a number input field');
10 var input = document.createElement('input');
12 function checkUnderflow(value, min, disabled)
14 input.value = value;
15 input.min = min;
16 input.disabled = !!disabled;
17 var underflow = input.validity.rangeUnderflow;
18 var resultText = 'The value "' + input.value + '" ' +
19 (underflow ? 'undeflows' : 'doesn\'t underflow') +
20 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
21 if (underflow)
22 testPassed(resultText);
23 else
24 testFailed(resultText);
27 function checkNotUnderflow(value, min, disabled)
29 input.value = value;
30 input.min = min;
31 input.disabled = !!disabled;
32 var underflow = input.validity.rangeUnderflow;
33 var resultText = 'The value "' + input.value + '" ' +
34 (underflow ? 'underflows' : 'doesn\'t underflow') +
35 ' the minimum value "' + input.min + '"' + (disabled ? ' when disabled.' : '.');
36 if (underflow)
37 testFailed(resultText);
38 else
39 testPassed(resultText);
42 debug('Type=number');
43 input.type = 'number';
44 input.max = '';
45 // No underflow cases
46 input.type = 'number';
47 checkNotUnderflow('101', '100'); // Very normal case.
48 checkNotUnderflow('-99', '-100');
49 checkNotUnderflow('101', '1E+2');
50 checkNotUnderflow('1.01', '1.00');
51 checkNotUnderflow('abc', '100'); // Invalid value.
52 checkNotUnderflow('', '1'); // No value.
53 checkNotUnderflow('-1', ''); // No min.
54 checkNotUnderflow('-1', 'xxx'); // Invalid min.
55 // The following case should be rangeUnderflow==true ideally. But the "double" type doesn't have enough precision.
56 checkNotUnderflow('0.999999999999999999999999999999999999999998', '0.999999999999999999999999999999999999999999');
58 // Underflow cases
59 checkUnderflow('99', '100');
60 checkUnderflow('-101', '-100');
61 checkUnderflow('99', '1E+2');
62 input.max = '100'; // value < min && value > max
63 checkUnderflow('101', '200');
65 // Disabled
66 checkNotUnderflow('99', '1E+2', true);
67 </script>
68 </body>
69 </html>