4 <script src=
"../../resources/js-test.js"></script>
7 <p id=
"description"></p>
8 <div id=
"console"></div>
10 description('Test styleWithCSS command');
12 function testStyleWithCSS(styleArg
, expectedState
)
14 document
.execCommand('styleWithCSS', false, styleArg
);
15 if (document
.queryCommandState('styleWithCSS') === expectedState
)
16 testPassed('styleWithCSS changed the state successfully');
18 testFailed('styleWithCSS failed with the argument ' + styleArg
);
21 testStyleWithCSS(true, true);
22 testStyleWithCSS('false', false);
23 testStyleWithCSS('FALSE', false);
24 testStyleWithCSS('random string', true);
25 testStyleWithCSS(null, true);
27 document
.execCommand('styleWithCSS', false, true);
28 if (document
.queryCommandState('styleWithCSS') === true)
29 testPassed("queryCommandState('styleWithCSS') returns true");
31 testFailed("queryCommandState('styleWithCSS') should return boolean true");
33 if (document
.queryCommandValue('styleWithCSS') === 'true')
34 testPassed("queryCommandValue('styleWithCSS') returns 'true'");
36 testFailed("queryCommandValue('styleWithCSS') should return 'true'");
38 document
.execCommand('styleWithCSS', false, false);
39 if (document
.queryCommandState('styleWithCSS') === false)
40 testPassed("queryCommandState('styleWithCSS') returns false");
42 testFailed("queryCommandState('styleWithCSS') should return boolean false");
44 if (document
.queryCommandValue('styleWithCSS') === 'false')
45 testPassed("queryCommandValue('styleWithCSS') returns 'false'");
47 testFailed("queryCommandValue('styleWithCSS') should return 'false'");