summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css/parsing-unexpected-eof.html
blob: 698e3149dc46298ab7b41bc0f16de1a729dd1844 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
  <head>
    <title>CSS Parser - auto-close for unexpected EOF</title>
    <script src="../../resources/testharness.js"></script>
    <script src="../../resources/testharnessreport.js"></script>
    <style>
      div {}
      div {}
    </style>
  </head>
  <body>
    <div id="qs"><i class="x"></i><b></b></div>
    <script>
      var sheet = document.styleSheets[0];
      var rules = sheet.cssRules;

      test(function(){
        // internal_decls
        rules[0].style.cssText = "width: 200px; color: rgb(10, 20, 30";
        assert_equals(rules[0].style.width, "200px", "Width not set correctly.");
        assert_equals(rules[0].style.color, "rgb(10, 20, 30)", "Color not set correctly");
      }, "Unexpected EOF - CSSStyleDeclaration.cssText missing ')'");

      test(function(){
        // internal_value
        rules[0].style.color = "rgba(0, 0, 0, 0.2";
        assert_equals(rules[0].style.color, "rgba(0, 0, 0, 0.2)", "rgba value not set correctly");
      }, "Unexpected EOF - CSSStyleDeclaration.color missing ')'");

      test(function(){
        // internal_selector
        rules[0].selectorText = "#x, [name=\"x";
        assert_equals(rules[0].selectorText, "#x, [name=\"x\"]");
      }, "Unexpected EOF - CSSStyleRule.selectorText missing ']'");

      test(function(){
        // internal_rule
        sheet.insertRule("span { color: green", 2);
        assert_equals(rules[2].cssText, "span { color: green; }");
      }, "Unexpected EOF - CSSStyleSheet.insertRule missing '}'");

      test(function(){
        // internal_selector
        assert_equals(document.querySelector("#qs [class=x").tagName, "I");
      }, "Unexpected EOF - querySelector missing ']'");

      test(function(){
        // internal_selector
        assert_equals(document.querySelector("#qs :nth-child(2").tagName, "B");
      }, "Unexpected EOF - querySelector missing ')'");
    </script>
  </body>
</html>