summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webidl/ecmascript-binding/legacy-platform-object/helper.js
blob: 01c1d00694eb9beb02b0c9d1d9c6ae1a2cc689c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function assert_prop_desc_equals(object, property_key, expected) {
  let actual = Object.getOwnPropertyDescriptor(object, property_key);
  if (expected === undefined) {
    assert_equals(
        actual, undefined,
        "(assert_prop_desc_equals: no property descriptor expected)");
    return;
  }
  for (p in actual) {
    assert_true(
        expected.hasOwnProperty(p),
        "(assert_prop_desc_equals: property '" + p + "' is not expected)");
    assert_equals(
        actual[p], expected[p],
        "(assert_prop_desc_equals: property '" + p + "')");
  }
  for (p in expected) {
    assert_true(
        actual.hasOwnProperty(p),
        "(assert_prop_desc_equals: expected property '" + p + "' missing)");
  }
}