Repository: mozilla/pdf.js
File: test/integration/annotation_spec.mjs (JavaScript)

Code before:
          })
        );
      });
    });
  });

  describe("Text under some annotations", () => {
    describe("bug1885505.pdf", () => {
      let pages;

      beforeEach(async () => {
        pages = await loadAndWait(
          "bug1885505.pdf",
          ":is(" +
            [56, 58, 60, 65]
              .map(id => `[data-annotation-id='${id}R']`)
              .join(", ") +
            ")"
        );
      });

      afterEach(async () => {
        await closePages(pages);
      });

      it("must check that an highlight as a mark element", async () => {
        await Promise.all(
          pages.map(async ([browserName, page]) => {
            const text = await page.$eval(
              "[data-annotation-id='56R'] mark",
              el => el.textContent
            );
            expect(text).withContext(`In ${browserName}`).toEqual("Languages");
          })
        );
      });

      it("must check that an underline as a u element", async () => {
        await Promise.all(
          pages.map(async ([browserName, page]) => {
            const text = await page.$eval(
              "[data-annotation-id='58R'] u",
              el => el.textContent
            );
            expect(text).withContext(`In ${browserName}`).toEqual("machine");
          })
        );
      });

      it("must check that an highlight as a squiggly/u element", async () => {
        await Promise.all(

Review comment (suggestion):
`must check that the text under a highlight annotation exist in the DOM` should convey the intent of the test a bit more clearly (similar for the squiggly, underline and strikeout annotation types below)

Code after:
          })
        );
      });
    });
  });

  describe("Text under some annotations", () => {
    describe("bug1885505.pdf", () => {
      let pages;

      beforeEach(async () => {
        pages = await loadAndWait(
          "bug1885505.pdf",
          ":is(" +
            [56, 58, 60, 65]
              .map(id => `[data-annotation-id='${id}R']`)
              .join(", ") +
            ")"
        );
      });

      afterEach(async () => {
        await closePages(pages);
      });

      it("must check that the text under a highlight annotation exist in the DOM", async () => {
        await Promise.all(
          pages.map(async ([browserName, page]) => {
            const text = await page.$eval(
              "[data-annotation-id='56R'] mark",
              el => el.textContent
            );
            expect(text).withContext(`In ${browserName}`).toEqual("Languages");
          })
        );
      });

      it("must check that the text under an underline annotation exist in the DOM", async () => {
        await Promise.all(
          pages.map(async ([browserName, page]) => {
            const text = await page.$eval(
              "[data-annotation-id='58R'] u",
              el => el.textContent
            );
            expect(text).withContext(`In ${browserName}`).toEqual("machine");
          })
        );
      });

      it("must check that the text under a squiggly annotation exist in the DOM", async () => {
        await Promise.all(