summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-syntax/at-rule-in-declaration-list.html
blob: f40975d27eadf436634491b4a158cee4f9c268ef (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!doctype html>
<title>CSS Syntax Test: handle at-rules in declaration lists</title>
<link rel="help" href="https://drafts.csswg.org/css-syntax/#consume-list-of-declarations">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="test_sheet">
</style>
<script>
  function parseRule(rule_text) {
    let sheet = test_sheet.sheet;
    if (sheet.cssRules.length != 0)
      sheet.deleteRule(0);
    sheet.insertRule(rule_text);
    return sheet.cssRules[0];
  }

  test(() => {
    let rule = parseRule(`
      div {
        @at {}
        color: green;
      }
    `);
    assert_equals(rule.style.color, "green");
  }, "Allow @-rule with block inside style rule");

  test(() => {
    let rule = parseRule(`
      div {
        @at at;
        color: green;
      }
    `);
    assert_equals(rule.style.color, "green");
  }, "Allow @-rule with semi-colon inside style rule");

  test(() => {
    let rule = parseRule(`
      @page {
        @at {}
        margin-top: 20px;
      }
    `);
    assert_equals(rule.style.marginTop, "20px");
  }, "Allow @-rule with block inside page rule");

  test(() => {
    let rule = parseRule(`
      @page {
        @at at;
        margin-top: 20px;
      }
    `);
    assert_equals(rule.style.marginTop, "20px");
  }, "Allow @-rule with semi-colon inside page rule");

  test(() => {
    let rule = parseRule(`
      @font-face {
        @at {}
        font-family: myfont;
      }
    `);
    assert_equals(rule.style.fontFamily, "myfont");
  }, "Allow @-rule with block inside font-face rule");

  test(() => {
    let rule = parseRule(`
      @font-face {
        @at at;
        font-family: myfont;
      }
    `);
    assert_equals(rule.style.fontFamily, "myfont");
  }, "Allow @-rule with semi-colon inside font-face rule");
</script>