5 var li
= document
.createElement("li");
6 li
.appendChild(document
.createTextNode(message
));
7 var console
= document
.getElementById("console");
8 console
.appendChild(li
);
11 function assert(func
, args
, expected
)
13 var f
= func
+ '("' + args
+ '")';
15 if (result
!= expected
)
16 log('Failure: ' + f
+ ' was ' + result
+ ', expected: ' + expected
);
18 log('Success: ' + f
+ ' == ' + result
);
23 <input id=
"textfield" type=
"text" style=
"width: 300" value=
"hello world">
24 <ol id=
"console"></ol>
28 if (window
.testRunner
)
29 window
.testRunner
.dumpAsText();
31 var e
= document
.getElementById("textfield");
33 e
.setSelectionRange(0, 5);
35 assert("document.queryCommandEnabled", "BackColor", false);
36 assert("document.queryCommandEnabled", "Bold", false);
37 assert("document.queryCommandEnabled", "Copy", true);
38 assert("document.queryCommandEnabled", "CreateLink", false);
39 assert("document.queryCommandEnabled", "Cut", true);
40 assert("document.queryCommandEnabled", "Delete", true);
41 assert("document.queryCommandEnabled", "FontName", true); // Shouldn't this be false?
42 assert("document.queryCommandEnabled", "FontSize", true); // Shouldn't this be false?
43 assert("document.queryCommandEnabled", "FontSizeDelta", true); // Shouldn't this be false?
44 assert("document.queryCommandEnabled", "ForeColor", false);
45 assert("document.queryCommandEnabled", "ForwardDelete", true);
46 assert("document.queryCommandEnabled", "Indent", false);
47 assert("document.queryCommandEnabled", "InsertHTML", true);
48 assert("document.queryCommandEnabled", "InsertImage", false);
49 assert("document.queryCommandEnabled", "InsertLineBreak", true);
50 assert("document.queryCommandEnabled", "InsertParagraph", true);
51 assert("document.queryCommandEnabled", "InsertNewlineInQuotedContent", false);
52 assert("document.queryCommandEnabled", "InsertText", true);
53 assert("document.queryCommandEnabled", "Italic", false);
54 assert("document.queryCommandEnabled", "JustifyCenter", false);
55 assert("document.queryCommandEnabled", "JustifyFull", false);
56 assert("document.queryCommandEnabled", "JustifyLeft", false);
57 assert("document.queryCommandEnabled", "JustifyNone", false);
58 assert("document.queryCommandEnabled", "JustifyRight", false);
59 assert("document.queryCommandEnabled", "Outdent", false);
60 assert("document.queryCommandEnabled", "Paste", true);
61 assert("document.queryCommandEnabled", "PasteAndMatchStyle", true);
62 assert("document.queryCommandEnabled", "SelectAll", true);
63 assert("document.queryCommandEnabled", "Strikethrough", false);
64 assert("document.queryCommandEnabled", "Subscript", false);
65 assert("document.queryCommandEnabled", "Superscript", false);
66 assert("document.queryCommandEnabled", "Underline", false);
67 assert("document.queryCommandEnabled", "Unlink", false);
68 assert("document.queryCommandEnabled", "Unselect", true);
70 e
.setSelectionRange(3, 3);
71 assert("document.queryCommandEnabled", "Transpose", true);
73 e
.setSelectionRange(0, 5);
74 assert("document.execCommand", "Cut", true);
75 assert("document.queryCommandEnabled", "Undo", true);
76 assert("document.execCommand", "Undo", true);
77 assert("document.queryCommandEnabled", "Redo", true);