Skip to content

Commit

Permalink
Change way of switching profiles on coverage page (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawel-bartkowiak-epam authored Jul 7, 2022
1 parent cc727c0 commit 7255612
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
test-materials/
# Ignore symlink to externally stored test materials
test-materials
node_modules/
32 changes: 18 additions & 14 deletions src/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ var GenerateCoverage = function () {
var coverage = document.getElementById("coverage");
coverage.innerHTML =
"<p>Coverage Report for " +
SelectedProfile.profile +
SelectedProfile.note +
'</p>\
<p>This lists how many pieces of test content exist, not if the content pass or fail.</p>\
<table><tr>\
Expand All @@ -97,19 +97,23 @@ var GenerateCoverage = function () {
<td style="background-color:' +
someContentColor +
'">Supported and number of content in Test Suite</td>\
</tr></table>\
Platform:';
var select = createAndAdd(coverage, "select");
Object.keys(Profiles).forEach((key) => {
var option = createAndAdd(select, "option");
option.value = key;
option.innerText = key;
option.selected = key == selectedConfig;
});
select.addEventListener("change", (event) => {
console.log(event.target.value);
window.localStorage["profile"] = event.target.value;
location.reload();
</tr></table>';
let profilesSpan = util.createElement("span", "profilesSpan", "rightmargin20", "Profile: ");
coverage.appendChild(profilesSpan);
Object.keys(Profiles).forEach((profileId) => {
let span = util.createElement("span", profileId, "rightmargin20", profileId);
span.setAttribute("tabindex", "0");
if (SelectedProfile === Profiles[profileId]) {
span.classList.add("bold");
} else {
span.classList.add("focusable");
let queryParams = new URLSearchParams(window.location.search);
queryParams.set("profile", profileId);
let url = `${location.origin}${location.pathname}?` + queryParams.toString();
span.setAttribute("data-href", url);
span.onclick = window.navigate;
}
profilesSpan.appendChild(span);
});

var coverage = createAndAdd(coverage, "div");
Expand Down

0 comments on commit 7255612

Please sign in to comment.