Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Marcos Cáceres
committed
Jan 16, 2017
1 parent
f71f3a3
commit 46268dd
Showing
7 changed files
with
147 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<!doctype html> | ||
<script src="/js/deps/require.js" data-main="/js/profile-w3c-common"> | ||
</script> | ||
<script class='remove'> | ||
function noOp() {} | ||
|
||
function preSyncFunc() { | ||
document.querySelector("#pre-sync").innerHTML = "pass"; | ||
} | ||
|
||
function preAsyncFunc() { | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
document.querySelector("#pre-async").innerHTML = "pass"; | ||
resolve(); | ||
}, 4); | ||
}); | ||
} | ||
|
||
function postSyncFunc() { | ||
document.querySelector("#post-sync").innerHTML = "pass"; | ||
} | ||
|
||
function postAsyncFunc() { | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
document.querySelector("#post-async").innerHTML = "pass"; | ||
resolve(); | ||
}, 4); | ||
}); | ||
} | ||
|
||
function afterEnd() { | ||
return new Promise(resolve => { | ||
setTimeout(() => { | ||
document.querySelector("#afterend").innerHTML = "pass"; | ||
resolve(); | ||
}, 4); | ||
}); | ||
} | ||
|
||
const respecConfig = { | ||
specStatus: "unofficial", | ||
shortName: "i", | ||
editors: [{ | ||
name: "Foo", | ||
url: "https://foo.com/" | ||
}], | ||
}; | ||
|
||
respecConfig.preProcess = [ | ||
preSyncFunc, | ||
preAsyncFunc, | ||
noOp, {}, | ||
]; | ||
|
||
respecConfig.postProcess = [ | ||
postSyncFunc, | ||
postAsyncFunc, | ||
noOp, {}, | ||
]; | ||
respecConfig.afterEnd = afterEnd; | ||
</script> | ||
<section id='abstract'> | ||
<p> | ||
abstract. | ||
</p> | ||
</section> | ||
<section id='sotd'> | ||
<p> | ||
CUSTOM PARAGRAPH | ||
</p> | ||
</section> | ||
<section> | ||
<p id="pre-sync">FAIL</p> | ||
<p id="pre-async">FAIL</p> | ||
<p id="post-sync">FAIL</p> | ||
<p id="post-async">FAIL</p> | ||
<p id="afterend">FAIL</p> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
"use strict"; | ||
describe("Core - preProcess, postProcess, afterEnd", () => { | ||
afterAll(done => { | ||
flushIframes(); | ||
done(); | ||
}); | ||
let doc; | ||
|
||
beforeAll(done => { | ||
const ops = makeStandardOps(); | ||
ops.config = null; // use src doc's config | ||
const cb = iframe => { | ||
doc = iframe; | ||
done(); | ||
}; | ||
makeRSDoc(ops, cb, "spec/core/pre-process-spec.html"); | ||
}); | ||
|
||
it("runs the preProcess and postProces arrays", () => { | ||
expect(doc.querySelector("#pre-sync").innerHTML).toEqual("pass"); | ||
expect(doc.querySelector("#pre-async").innerHTML).toEqual("pass"); | ||
expect(doc.querySelector("#post-sync").innerHTML).toEqual("pass"); | ||
expect(doc.querySelector("#post-async").innerHTML).toEqual("pass"); | ||
}); | ||
|
||
it("runs afterEnd method", () => { | ||
expect(doc.querySelector("#afterend").innerHTML).toEqual("pass"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters