add_task(async function testL10nAttrs() {
let el = await renderTemplate();
window.el = el;
defineExampleElement();
is(el.shadowRoot.textContent, "", "There's no text");
is(
el.dataset.l10nAttrs, "label,message,tooltiptext,rename,accesskey", "data-l10n-attrs is set"
);
await new Promise(r => el.addEventListener("label-changed", r, { once: true }));
is(
el.shadowRoot.textContent, "Example label!And a message!Also a tooltiptext!Also renamed!E", "Text rendered automatically on upgrade"
);
is(el.accessKey, "E", "accessKey is mapped with custom attribute");
ok(!el.hasAttribute("accesskey"), "renamed attribute was removed");
});
add_task(async function testMappedAttributes() {
let el = await renderTemplate( html`<example-element accesskey="f" mapped="mapped-val" aria-label="Label!"></example-element>`
);
is(el.accessKey, "f", "accessKey property is correct");
ok(!el.hasAttribute("accesskey"), "accesskey attribute was removed");
is(el.mappedAttribute, "mapped-val", "mappedAttribute is mapped with custom attribute");
ok(!el.hasAttribute("mapped"), "mapped attribute was removed");
is(el.ariaLabel, "Label!", "ariaLabel property is set");
ok(!el.hasAttribute("aria-label"), "aria-label was removed");
});
</script>
</head>
<body>
<div id="render"></div>
</body>
</html>
Messung V0.5
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.