OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>ExecCommand argument combinations</title> | 4 <title>ExecCommand argument combinations</title> |
5 <style> | 5 <style> |
6 .pass { font-weight: bold; color: green; } | 6 .pass { font-weight: bold; color: green; } |
7 .fail { font-weight: bold; color: red; } | 7 .fail { font-weight: bold; color: red; } |
8 #console { border: 1px solid black; padding: 10px; margin-bottom: 20
px; } | 8 #console { border: 1px solid black; padding: 10px; margin-bottom: 20
px; } |
9 </style> | 9 </style> |
10 <script type="text/javascript"> | 10 <script type="text/javascript"> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Test with 3 arguments. | 63 // Test with 3 arguments. |
64 test('document.execCommand("InsertHorizontalRule", false, "foo")
', '<hr id="foo">'); | 64 test('document.execCommand("InsertHorizontalRule", false, "foo")
', '<hr id="foo">'); |
65 | 65 |
66 // Test with 4 arguments. (should ignore the fourth argument sil
ently) | 66 // Test with 4 arguments. (should ignore the fourth argument sil
ently) |
67 test('document.execCommand("InsertHorizontalRule", false, "foo",
"bar")', '<hr id="foo">'); | 67 test('document.execCommand("InsertHorizontalRule", false, "foo",
"bar")', '<hr id="foo">'); |
68 | 68 |
69 // Test empty String 3rd parameter. (should not add an empty id
value) | 69 // Test empty String 3rd parameter. (should not add an empty id
value) |
70 test('document.execCommand("InsertHorizontalRule", false, "")',
'<hr>'); | 70 test('document.execCommand("InsertHorizontalRule", false, "")',
'<hr>'); |
71 | 71 |
72 // Test null 3rd parameter. (should treat as if only two argumen
ts were passed, same as undefined) | 72 // Test null 3rd parameter. (should stringify to "null") |
73 test('document.execCommand("InsertHorizontalRule", false, null)'
, '<hr>'); | 73 test('document.execCommand("InsertHorizontalRule", false, null)'
, '<hr id="null">'); |
74 | 74 |
75 // Test undefined 3rd parameter. (should treat as if only two ar
guments were passed, same as null) | 75 // Test undefined 3rd parameter. (should treat as if only two ar
guments were passed) |
76 test('document.execCommand("InsertHorizontalRule", false, undefi
ned)', '<hr>'); | 76 test('document.execCommand("InsertHorizontalRule", false, undefi
ned)', '<hr>'); |
77 | 77 |
78 // Test 0 for 3rd parameter. (nothing special, id value should e
qual the string 0) | 78 // Test 0 for 3rd parameter. (nothing special, id value should e
qual the string 0) |
79 test('document.execCommand("InsertHorizontalRule", false, 0)', '
<hr id="0">'); | 79 test('document.execCommand("InsertHorizontalRule", false, 0)', '
<hr id="0">'); |
80 | 80 |
81 // Test undefined 3rd parameter implicitly using helper function
. (should treat as if only two arguments were passed, same as null) | 81 // Test undefined 3rd parameter implicitly using helper function
. (should treat as if only two arguments were passed, same as null) |
82 test('function ExecCommand(command, commandParam) { document.exe
cCommand(command, false, commandParam); } ExecCommand("InsertHorizontalRule");',
'<hr>'); | 82 test('function ExecCommand(command, commandParam) { document.exe
cCommand(command, false, commandParam); } ExecCommand("InsertHorizontalRule");',
'<hr>'); |
83 } | 83 } |
84 </script> | 84 </script> |
85 </head> | 85 </head> |
86 <body onload="runTests();"> | 86 <body onload="runTests();"> |
87 <p>These are tests for testing the how execCommand() works with differen
t combinations of arguments. The "InsertHorizontalRule" command was | 87 <p>These are tests for testing the how execCommand() works with differen
t combinations of arguments. The "InsertHorizontalRule" command was |
88 chosen arbitrarily because it was what I was working on at the time,
but the results should be paralleled in the other commands as well.</p> | 88 chosen arbitrarily because it was what I was working on at the time,
but the results should be paralleled in the other commands as well.</p> |
89 | 89 |
90 <h4>CONSOLE</h4> | 90 <h4>CONSOLE</h4> |
91 <pre id='console'></pre> | 91 <pre id='console'></pre> |
92 </body> | 92 </body> |
93 </html> | 93 </html> |
OLD | NEW |