summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-typed-om/the-stylepropertymap/inline/get-shorthand.html
blob: 6ce318d5995cd10c1fd15d3d3c24ae7863783364 (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
<!doctype html>
<meta charset="utf-8">
<title>Inline StylePropertyMap.get with shorthands</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#get-a-value-from-a-stylepropertymap">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../resources/testhelper.js"></script>
<body>
<div id="log">
<script>
'use strict';

test(t => {
  const styleMap = createInlineStyleMap(t, 'margin: 1px 2px 3px 4px');
  const result = styleMap.get('margin');
  assert_not_equals(result, null, 'Shorthand value must not be null');
  assert_class_string(result, 'CSSStyleValue',
    'Shorthand value must be a base CSSStyleValue');
}, 'Getting an shorthand property set explicitly in inline style returns ' +
   'a base CSSStyleValue');

test(t => {
  const styleMap = createInlineStyleMap(t, 'margin-top: 1px');
  const result = styleMap.get('margin');
  assert_equals(result, null,
    'Shorthand value must be null as it is not explicitly set');
}, 'Getting a shorthand property that is partially set in inline style ' +
   'returns null');

test(t => {
  const styleMap = createDivWithoutStyle(t).attributeStyleMap;
  assert_equals(styleMap.get('margin'), null,
    'Shorthand value must be null for element without style');
}, 'Getting an attributeStyleMap shorthand property from an element without ' +
   'a style attribute');
</script>