Skip to content

Commit

Permalink
chore(ui/dfn-list): remove ui/dfn-list in favor of id=index (speced#3065
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sidvishnoi authored Aug 25, 2020
1 parent e462696 commit bad2470
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 155 deletions.
1 change: 0 additions & 1 deletion profiles/dini.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const modules = [
import("../src/core/informative.js"),
import("../src/core/id-headers.js"),
import("../src/ui/save-html.js"),
import("../src/ui/dfn-list.js"),
import("../src/ui/about-respec.js"),
import("../src/core/seo.js"),
import("../src/core/highlight.js"),
Expand Down
1 change: 0 additions & 1 deletion profiles/geonovum.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ const modules = [
import("../src/geonovum/conformance.js"),
import("../src/ui/save-html.js"),
import("../src/ui/search-specref.js"),
import("../src/ui/dfn-list.js"),
import("../src/ui/about-respec.js"),
import("../src/core/seo.js"),
import("../src/core/highlight.js"),
Expand Down
1 change: 0 additions & 1 deletion profiles/w3c-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const modules = [
import("../src/core/mdn-annotation.js"),
import("../src/ui/save-html.js"),
import("../src/ui/search-specref.js"),
import("../src/ui/dfn-list.js"),
import("../src/ui/about-respec.js"),
import("../src/core/seo.js"),
import("../src/w3c/seo.js"),
Expand Down
1 change: 0 additions & 1 deletion profiles/w3c.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const modules = [
import("../src/ui/save-html.js"),
import("../src/ui/search-specref.js"),
import("../src/ui/search-xref.js"),
import("../src/ui/dfn-list.js"),
import("../src/ui/about-respec.js"),
import("../src/core/seo.js"),
import("../src/w3c/seo.js"),
Expand Down
93 changes: 0 additions & 93 deletions src/ui/dfn-list.js

This file was deleted.

58 changes: 0 additions & 58 deletions tests/spec/core/ui-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,62 +67,4 @@ describe("Core - UI", () => {
expect(button.textContent).toBe("2");
expect(button.getAttribute("aria-label")).toBe("2 ReSpec Warnings");
});

describe("ui/dfn-list", () => {
it("shows a list of definitions and links them", async () => {
const body = "<p><dfn>bar()</dfn> <dfn>foo</dfn></p>";
const ops = makeStandardOps(null, body);
const doc = await makeRSDoc(ops);

// open list and wait for loading
const dfnListButton = doc.getElementById("respec-button-definitions");
dfnListButton.click();
await new Promise(resolve => setTimeout(resolve));

const dfns = doc.querySelectorAll("ul.respec-dfn-list li a");
expect(dfns).toHaveSize(2);

const [dfnBar, dfnFoo] = dfns;
expect(dfnBar.textContent.trim()).toBe("bar()");
expect(dfnBar.getAttribute("href")).toBe("#dfn-bar");
expect(dfnFoo.textContent.trim()).toBe("foo");
expect(dfnFoo.getAttribute("href")).toBe("#dfn-foo");
});
});

it("shows a list of definitions and labels definitions that are unused and/or exported", async () => {
const body = `
<p>
<dfn>foo</dfn>
<dfn data-export="">bar()</dfn>
<dfn data-export="">foobar</dfn>
<dfn>baz</dfn>
</p>
<p>References to <a>Foo</a> and <a>foobar</a>.</p>
`;

const ops = makeStandardOps(null, body);
const doc = await makeRSDoc(ops);

// open list and wait for it to load
const dfnListButton = doc.getElementById("respec-button-definitions");
dfnListButton.click();
await new Promise(resolve => setTimeout(resolve));

const dfns = doc.querySelectorAll("ul.respec-dfn-list li");
expect(dfns).toHaveSize(4);

const [dfnBar, dfnBaz, dfnFoo, dfnFoobar] = dfns;

expect(dfnBar.textContent).toContain("exported unused");

expect(dfnBaz.textContent).toContain("unused");
expect(dfnBaz.textContent).not.toContain("exported");

expect(dfnFoo.textContent).not.toContain("unused");
expect(dfnFoo.textContent).not.toContain("exported");

expect(dfnFoobar.textContent).toContain("exported");
expect(dfnFoobar.textContent).not.toContain("unused");
});
});

0 comments on commit bad2470

Please sign in to comment.