Skip to content

Commit 9c2bda9

Browse files
committed
Fixup tests for better safari compat
1 parent e691846 commit 9c2bda9

File tree

3 files changed

+11
-43
lines changed

3 files changed

+11
-43
lines changed

tests/spec/core/highlight-spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ describe("Core — Highlight", () => {
1212
afterAll(flushIframes);
1313

1414
it("highlights remote languages not bundled by default with ReSpec", async () => {
15-
const doc = await makeRSDoc({}, "spec/core/highlight.html");
15+
const doc = await makeRSDoc(null, "spec/core/highlight.html");
1616
const span = doc.querySelector("code.testlang span[class*=hljs]");
1717
expect(span.textContent).toBe("funkyFunction");
1818
});

tests/spec/core/highlight.html

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
<html>
33
<head>
44
<meta charset='utf-8'>
5-
<title>Replace me with a real title</title>
6-
<script class='remove' src='/builds/respec-w3c.js'></script>
5+
<title>Highlight tester</title>
76
<script class='remove'>
8-
async function loadSolidity() {
7+
async function loadHighlighter() {
98
const worker = await new Promise(resolve => {
109
require(["core/worker"], ({ worker }) => resolve(worker));
1110
});
@@ -25,8 +24,8 @@
2524
});
2625
}
2726
var respecConfig = {
28-
preProcess: [loadSolidity],
29-
specStatus: "ED",
27+
preProcess: [loadHighlighter],
28+
specStatus: "base",
3029
editors: [
3130
{
3231
name: "Your Name",
@@ -39,14 +38,6 @@
3938
</head>
4039
<body>
4140
<section id='abstract'>
42-
<p>
43-
This is required.
44-
</p>
45-
</section>
46-
<section id='sotd'>
47-
<p>
48-
This is required.
49-
</p>
5041
<pre class="example testlang">
5142
funkyFunction
5243
</pre>

tests/spec/core/seo-spec.js

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,10 @@ describe("Core — Seo", () => {
1616
body: makeDefaultBody(),
1717
};
1818
const doc = await makeRSDoc(ops);
19-
await doc.respec.ready;
20-
await new Promise(resolve => {
21-
const check = () => {
22-
const hasMetaDesc = doc.querySelectorAll("meta[name=description]");
23-
expect(hasMetaDesc).toHaveSize(0);
24-
resolve();
25-
};
26-
window.requestIdleCallback ? window.requestIdleCallback(check) : check();
27-
});
19+
expect(doc.querySelectorAll("meta[name=description]")).toHaveSize(0);
2820
});
2921

30-
it("inserts a meta element for the description after processing", async () => {
22+
it("inserts a meta element for the description", async () => {
3123
const ops = {
3224
config: makeBasicConfig(),
3325
abstract: `<p>
@@ -37,24 +29,9 @@ describe("Core — Seo", () => {
3729
body: makeDefaultBody(),
3830
};
3931
const doc = await makeRSDoc(ops);
40-
await doc.respec.ready;
41-
await new Promise(resolve => {
42-
const check = () => {
43-
const hasMetaDesc = doc.querySelectorAll("meta[name=description]")
44-
.length;
45-
// Firefox is buggy, short circuit
46-
if (navigator.userAgent.includes("Firefox") && !hasMetaDesc) {
47-
expect(true).toBe(true);
48-
return;
49-
}
50-
expect(hasMetaDesc).toBe(1);
51-
const meta = doc.head.querySelector("meta[name=description]");
52-
expect(meta.content).toBe("Pass");
53-
resolve();
54-
};
55-
window.requestIdleCallback
56-
? doc.defaultView.requestIdleCallback(check)
57-
: check();
58-
});
32+
const metaTags = doc.querySelectorAll("meta[name=description]");
33+
expect(metaTags).toHaveSize(1);
34+
const meta = doc.head.querySelector("meta[name=description]");
35+
expect(meta.content).toBe("Pass");
5936
});
6037
});

0 commit comments

Comments
 (0)