MCPcopy Create free account
hub / github.com/nodejs/node / checkDataKeys

Function checkDataKeys

test/fixtures/wpt/resources/check-layout-th.js:28–63  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

26}
27
28function checkDataKeys(node) {
29 // The purpose of this list of data-* attributes is simply to ensure typos
30 // in tests are caught. It is therefore "ok" to add to this list for
31 // specific tests.
32 var validData = new Set([
33 "data-anchor-polyfill",
34 "data-expected-width",
35 "data-expected-height",
36 "data-offset-x",
37 "data-offset-y",
38 "data-expected-client-width",
39 "data-expected-client-height",
40 "data-expected-scroll-width",
41 "data-expected-scroll-height",
42 "data-expected-bounding-client-rect-width",
43 "data-expected-bounding-client-rect-height",
44 "data-total-x",
45 "data-total-y",
46 "data-expected-display",
47 "data-expected-padding-top",
48 "data-expected-padding-bottom",
49 "data-expected-padding-left",
50 "data-expected-padding-right",
51 "data-expected-margin-top",
52 "data-expected-margin-bottom",
53 "data-expected-margin-left",
54 "data-expected-margin-right"
55 ]);
56 if (!node || !node.getAttributeNames)
57 return;
58 // Use "data-test" prefix if you need custom-named data elements.
59 for (let name of node.getAttributeNames()) {
60 if (name.startsWith("data-") && !name.startsWith("data-test"))
61 assert_true(validData.has(name), name + " is a valid data attribute");
62 }
63}
64
65function checkExpectedValues(t, node, prefix)
66{

Callers 1

checkExpectedValuesFunction · 0.85

Calls 2

assert_trueFunction · 0.70
hasMethod · 0.65

Tested by

no test coverage detected