Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only count each WPT test once for the summary view #2304

Merged
merged 4 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions bikeshed/wpt/wptScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ document.addEventListener("DOMContentLoaded", async ()=>{
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -31,10 +32,6 @@ document.addEventListener("DOMContentLoaded", async ()=>{
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -44,6 +41,17 @@ document.addEventListener("DOMContentLoaded", async ()=>{
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know the indentation in this file is inconsistent between tabs and spaces (ugh, I dunno how that happened) but that doesn't mean that mixing 4-space and 2-space indents is allowed as well. ^_^ Mind switching it all to tab-based?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops on the 2-space vs 4-space, my bad. Will fix that. I don't see the tabs though; I think my PR introduces the only tabs in the file actually (unless my editor is lying to me?).

Changed to all space-indented, 4-space indentation for now. If you want, I can definitely turn it all into tabs, let me know :).

seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -100,4 +108,4 @@ function formatWptResult({name, version, passes, total}) {
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}
}
19 changes: 14 additions & 5 deletions tests/github/WICG/idle-detection/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2132,6 +2132,7 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -2140,10 +2141,6 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -2153,6 +2150,17 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -2209,4 +2217,5 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/WICG/portals/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3487,6 +3487,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -3495,10 +3496,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -3508,6 +3505,17 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -3564,4 +3572,5 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/WICG/scroll-to-text-fragment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3565,6 +3565,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -3573,10 +3574,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -3586,6 +3583,17 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -3642,4 +3650,5 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/w3c/csswg-drafts/css-break-3/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -2994,6 +2994,7 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -3002,10 +3003,6 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -3015,6 +3012,17 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -3071,4 +3079,5 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/w3c/csswg-drafts/css-color-4/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -8514,6 +8514,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -8522,10 +8523,6 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -8535,6 +8532,17 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -8591,4 +8599,5 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/w3c/csswg-drafts/css-contain-1/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3077,6 +3077,7 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -3085,10 +3086,6 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -3098,6 +3095,17 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -3154,4 +3162,5 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
19 changes: 14 additions & 5 deletions tests/github/w3c/csswg-drafts/css-contain-2/Overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -3827,6 +3827,7 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
const passes = result.legacy_status.map(x=>[x.passes, x.total]);
return [testPath, passes];
}));
const seenTests = new Set();
document.querySelectorAll(".wpt-name").forEach(nameEl=>{
const passData = resultsFromPath.get("/" + nameEl.getAttribute("title"));
const numTests = passData[0][1];
Expand All @@ -3835,10 +3836,6 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el("small", {}, ` (${numTests} tests)`));
}
if(passData == undefined) return;
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
})
const resultsEl = el("span",{"class":"wpt-results"},
...passData.map((p,i) => el("span",
{
Expand All @@ -3848,6 +3845,17 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
})),
);
nameEl.insertAdjacentElement("afterend", resultsEl);

// Only update the summary pass/total count if we haven't seen this
// test before, to support authors listing the same test multiple times
// in a spec.
if (!seenTests.has(nameEl.getAttribute("title"))) {
seenTests.add(nameEl.getAttribute("title"));
passData.forEach((p,i) => {
browsers[i].passes += p[0];
browsers[i].total += p[1];
});
}
});
const overview = document.querySelector(".wpt-overview");
if(overview) {
Expand Down Expand Up @@ -3904,4 +3912,5 @@ <h2 class="no-num no-ref heading settled" id="property-index"><span class="conte
el('br', {}),
el('nobr', {'class':'pass-rate'}, `${passes}/${total}`)
);
}</script>
}
</script>
Loading