progress.html (2566B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <title>The progress element</title> 5 6 <link rel="author" title="dan smith" href="mailto:XX1011@gmail.com"> 7 <link rel="author" title="Tomoyuki SHIMIZU" href="mailto:tomoyuki.labs@gmail.com"> 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-progress-element"> 9 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 </head> 13 <body> 14 <div id="log"></div> 15 16 <progress id="indeterminate"></progress> 17 <progress id="removevalue" value="0.5"></progress> 18 <progress id="quarter" value="1" max="4"></progress> 19 <progress id="largerthanmax" value="2"></progress> 20 <progress id="invalidmax" value="1" max="a"></progress> 21 <progress id="negativemax" value="1" max="-1"></progress> 22 <progress id="invalidvalue" value="a"></progress> 23 <progress id="negativevalue" value="-1"></progress> 24 25 <script> 26 27 test(function() { 28 assert_equals(indeterminate.position, -1); 29 }, "Indeterminate progress bar should have position -1"); 30 31 test(function() { 32 removevalue.removeAttribute('value'); 33 assert_equals(removevalue.position, -1); 34 }, "Revoming the value attribute makes an intermediate progress bar, which should have position -1"); 35 36 test(function() { 37 assert_equals(quarter.position, quarter.value / quarter.max); 38 }, "Determinate progress bar should have fractional position"); 39 40 test(function() { 41 assert_equals(indeterminate.value, 0); 42 }, "Indeterminate progress bar should have value 0"); 43 44 test(function() { 45 assert_equals(largerthanmax.value, 1); 46 }, "Value must equal max if the parsed value is larger than max"); 47 48 test(function() { 49 assert_equals(indeterminate.max, 1); 50 }, "Max must be 1 by default"); 51 52 test(function() { 53 assert_equals(largerthanmax.max, 1); 54 }, "Max must be 1 by default, even if value is specified"); 55 56 test(function() { 57 assert_equals(invalidmax.max, 1); 58 }, "Max must be 1 if max value is invalid"); 59 60 test(function() { 61 assert_equals(negativemax.max, 1); 62 }, "Max must be 1 if the parsed max value is less than or equal to zero"); 63 64 test(function() { 65 assert_equals(invalidvalue.value, 0); 66 }, "Value must be 0 if value is invalid"); 67 68 test(function() { 69 assert_equals(negativevalue.value, 0); 70 }, "Value must be 0 if the parsed value is less than or equal to zero"); 71 72 </script> 73 </body> 74 </html>