/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ "use strict"; addPdfStructTreeTest( "testBasic", `

h1

p1

h2
  1. oli
tc1tc2
tc3tc4
`, [ { role: "Root", children: [ { role: "Document", children: [ { role: "H1", children: [ { role: "NonStruct", children: [{ content: ["h1"] }] }, ], }, { role: "P", children: [ { role: "NonStruct", children: [{ content: ["p1"] }] }, ], }, { role: "H2", children: [ { role: "NonStruct", children: [{ content: ["h2"] }] }, ], }, { role: "L", children: [ { role: "LI", children: [ { role: "Lbl", children: [{ content: ["•"] }] }, { role: "NonStruct", children: [{ content: [" ", "uli1"] }], }, ], }, { role: "LI", children: [ { role: "Lbl", children: [{ content: ["•"] }] }, { role: "NonStruct", children: [{ content: [" ", "uli2"] }], }, ], }, ], }, { role: "L", children: [ { role: "LI", children: [ { role: "Lbl", children: [{ content: ["1."] }] }, { role: "NonStruct", children: [{ content: [" ", "oli"] }], }, ], }, ], }, { role: "Table", children: [ { role: "TR", children: [ { // XXX pdf.js doesn't support attributes yet, so we can't // test scope, headers, col/row span, etc. role: "TH", children: [ { role: "NonStruct", children: [{ content: ["tc1"] }] }, ], }, { role: "TH", children: [ { role: "NonStruct", children: [{ content: [" ", "tc2"] }], }, ], }, ], }, { role: "TR", children: [ { role: "TH", children: [ { role: "NonStruct", children: [{ content: ["tc3"] }] }, ], }, { role: "TD", children: [ { role: "NonStruct", children: [{ content: [" ", "tc4"] }], }, ], }, ], }, ], }, ], }, ], }, ], { chrome: true, topLevel: true } ); addPdfStructTreeTest( "testIframe", `

inside

`, [ { role: "Root", children: [ { role: "Document", children: [ { role: "NonStruct", // iframe children: [ { role: "Document", children: [ { role: "H1", children: [ { role: "NonStruct", children: [{ content: ["inside"] }], }, ], }, ], }, // XXX We render an empty marked content sequence after an // iframe document for some unknown reason. This is inconsequential. { content: [] }, ], }, ], }, ], }, ], { topLevel: false, iframe: true, remoteIframe: true } ); addPdfStructTreeTest( "testIframeWithSurroundingContent", `

before

after

`, [ { role: "Root", children: [ { role: "Document", children: [ { role: "H1", children: [ { role: "NonStruct", children: [{ content: ["before"] }] }, ], }, { role: "NonStruct", // iframe children: [ { role: "Document", children: [ { role: "H2", children: [ { role: "NonStruct", children: [{ content: ["inside"] }], }, ], }, ], }, { content: [] }, ], }, { role: "H3", children: [ { role: "NonStruct", children: [{ content: ["after"] }] }, ], }, ], }, ], }, ] ); addPdfStructTreeTest( "testAriaOwns", `

h1

h2

h3

`, [ { role: "Root", children: [ { role: "Document", children: [ { role: "NonStruct", // div children: [ { role: "H3", children: [ { role: "NonStruct", children: [{ content: ["h3"] }] }, ], }, { role: "H2", children: [ { role: "NonStruct", children: [{ content: ["h2"] }] }, ], }, { role: "H1", children: [ { role: "NonStruct", children: [{ content: ["h1"] }] }, ], }, ], }, ], }, ], }, ], { chrome: true, topLevel: true } );