Backed out 2 changesets (bug 1573143) for browser_certViewer.js failures CLOSED TREE

Backed out changeset 8ca11a6e2a3a (bug 1573143)
Backed out changeset 43410a278604 (bug 1573143)
This commit is contained in:
Bogdan Tara 2019-09-27 16:34:04 +03:00
Родитель 11dc2d37c2
Коммит 5c23fc2017
8 изменённых файлов: 8 добавлений и 117 удалений

Просмотреть файл

@ -5,7 +5,6 @@
import { updateSelectedItem } from "../certviewer.js";
import { InfoGroup } from "./info-group.js";
import { ErrorSection } from "./error-section.js";
import { normalizeToKebabCase } from "../utils.js";
class CertificateSection extends HTMLElement {
constructor(certs, error) {
@ -120,23 +119,15 @@ class CertificateSection extends HTMLElement {
}
this.infoGroupsContainers[i].classList.add("info-groups");
this.shadowRoot.appendChild(this.infoGroupsContainers[i]);
let final = false;
if (i === this.certs.length - 1) {
final = true;
}
for (let j = 0; j < certArray.length; j++) {
this.infoGroupsContainers[i].appendChild(
new InfoGroup(certArray[j], final)
);
this.infoGroupsContainers[i].appendChild(new InfoGroup(certArray[j]));
}
}
createTabSection(tabName, i, certificateTabs) {
let tab = document.createElement("button");
tab.textContent = tabName;
tab.setAttribute("id", normalizeToKebabCase(tabName));
tab.setAttribute("id", "tab" + i);
tab.setAttribute("aria-controls", "panel" + i);
tab.setAttribute("idnumber", i);
tab.setAttribute("role", "tab");

Просмотреть файл

@ -3,14 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
import { InfoItem } from "./info-item.js";
import { updateSelectedItem } from "../certviewer.js";
import { normalizeToKebabCase } from "../utils.js";
export class InfoGroup extends HTMLElement {
constructor(item, final) {
constructor(item) {
super();
this.item = item;
this.final = final;
}
connectedCallback() {
@ -34,38 +31,6 @@ export class InfoGroup extends HTMLElement {
for (let i = 0; i < this.item.sectionItems.length; i++) {
this.shadowRoot.append(new InfoItem(this.item.sectionItems[i]));
}
if (this.item.sectionId === "issuer-name") {
this.setLinkToTab();
}
}
setLinkToTab() {
if (this.final) {
return;
}
let issuerCommonName = this.shadowRoot
.querySelector(".common-name")
.shadowRoot.querySelector(".info");
let link = document.createElement("a");
link.textContent = issuerCommonName.textContent;
link.setAttribute("href", "#");
issuerCommonName.textContent = "";
issuerCommonName.appendChild(link);
link.addEventListener("click", () => {
let id = normalizeToKebabCase(link.textContent);
let issuerTab = document
.querySelector("certificate-section")
.shadowRoot.getElementById(id);
let index = issuerTab.getAttribute("idnumber");
updateSelectedItem(index);
});
}
}

Просмотреть файл

@ -10,6 +10,5 @@ support-files =
support-files =
dummy_page.html
[browser_renderCertToUI.js]
[browser_certificateTabLink.js]
[browser_downloadLink.js]
[browser_clickableLink.js]

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -31,7 +31,7 @@ add_task(async function test() {
}
let tabButton = certificateSection.shadowRoot.querySelector(
`.certificate-tabs .tab[idnumber="${tabID}"]`
`.certificate-tabs #tab${tabID}`
);
tabButton.click();

Просмотреть файл

@ -21,7 +21,7 @@ add_task(async function test() {
for (let i = 0; i < tabs.length; i++) {
let tabButton = certificateSection.shadowRoot.querySelector(
`.certificate-tabs .tab[idnumber="${i}"]`
`.certificate-tabs #tab${i}`
);
tabButton.click();

Просмотреть файл

@ -29,7 +29,7 @@ async function checkSubjectName(inputPage, subjectsNameInfo) {
".certificate-tabs"
);
let tab = tabs.querySelector(`.tab[idnumber="${index}"]`);
let tab = tabs.querySelector(`#tab${index}`);
Assert.ok(tab, `Tab at index ${index} found`);
Assert.equal(tab.innerText, tabName, `Tab name should be ${tabName}`);

Просмотреть файл

@ -37,9 +37,8 @@ add_task(async function test() {
"infoGroups must have the same length of adjustedCerts"
);
let tabName = certificateSection.shadowRoot.querySelector(
".tab[idnumber='0']"
).textContent;
let tabName = certificateSection.shadowRoot.querySelector("#tab0")
.textContent;
Assert.equal(tabName, expectedTabName, "Tab name should be the same");
function getElementByAttribute(source, property, target) {