upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / editing / execCommand / style-with-css.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('Test styleWithCSS command');
11
12 function testStyleWithCSS(styleArg, expectedState)
13 {
14     document.execCommand('styleWithCSS', false, styleArg); 
15     if (document.queryCommandState('styleWithCSS') === expectedState)
16         testPassed('styleWithCSS changed the state successfully');
17     else
18         testFailed('styleWithCSS failed with the argument ' + styleArg);
19 }
20
21 testStyleWithCSS(true, true);
22 testStyleWithCSS('false', false);
23 testStyleWithCSS('FALSE', false);
24 testStyleWithCSS('random string', true);
25 testStyleWithCSS(null, true);
26
27 document.execCommand('styleWithCSS', false, true);
28 if (document.queryCommandState('styleWithCSS') === true)
29     testPassed("queryCommandState('styleWithCSS') returns true");
30 else
31     testFailed("queryCommandState('styleWithCSS') should return boolean true");
32
33 if (document.queryCommandValue('styleWithCSS') === 'true')
34     testPassed("queryCommandValue('styleWithCSS') returns 'true'");
35 else
36     testFailed("queryCommandValue('styleWithCSS') should return 'true'");
37
38 document.execCommand('styleWithCSS', false, false);
39 if (document.queryCommandState('styleWithCSS') === false)
40     testPassed("queryCommandState('styleWithCSS') returns false");
41 else
42     testFailed("queryCommandState('styleWithCSS') should return boolean false");
43
44 if (document.queryCommandValue('styleWithCSS') === 'false')
45     testPassed("queryCommandValue('styleWithCSS') returns 'false'");
46 else
47     testFailed("queryCommandValue('styleWithCSS') should return 'false'");
48
49 </script>
50 <script src="../../fast/js/resources/js-test-post.js"></script>
51 </body>
52 </html>