Skip to content

Commit f9ba9b4

Browse files
author
Christopher Baker
committed
add fix for zombie
1 parent 29efc30 commit f9ba9b4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
"bit-docs-generate-html": "^0.1.0",
3030
"connect": "^2.14.4",
3131
"mocha": "^3.1.2",
32-
"q": "^1.4.1",
33-
"zombie": "^4.2.1"
32+
"zombie": "^4.3.0"
3433
},
3534
"dependencies": {
3635
"prismjs": "^1.11.0"

test.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
var generate = require("bit-docs-generate-html/generate");
2-
var Q = require("q");
32
var path = require("path");
3+
var fs = require("fs");
44
var assert = require("assert");
55

66
var Browser = require("zombie");
77
var connect = require("connect");
88

9+
var zombieFixes = "Object.defineProperty(HTMLElement.prototype, 'classList', { get: function() { var parent = this; var classList = parent.className.split(' '); classList.contains = classList.includes; classList.add = function(token) { this.push(token); parent.className = this.join(' '); }; return classList; } });\n\n";
10+
911
var open = function(url, callback, done) {
1012
var server = connect().use(connect.static(path.join(__dirname))).listen(8081);
1113
var browser = new Browser();
@@ -27,7 +29,7 @@ describe("bit-docs-prettify", function() {
2729
it("basics work", function(done) {
2830
this.timeout(30000);
2931

30-
var docMap = Q({
32+
var docMap = Promise.resolve({
3133
index: {
3234
name: "index",
3335
body: "```javascript\nvar str = 'hello world';\n```\n\n```css\nbody {\n margin: 0;\n background: purple;\n}\n```\n\n```shell\npwd\n```\n\n```\n// some misc code\n```"
@@ -45,13 +47,16 @@ describe("bit-docs-prettify", function() {
4547
forceBuild: true
4648
})
4749
.then(function() {
50+
var stealPath = path.join(__dirname, "temp", "static", "node_modules", "steal", "steal.production.js");
51+
fs.writeFileSync(stealPath, zombieFixes + fs.readFileSync(stealPath, "utf8"));
52+
4853
open("temp/index.html", function(browser, close) {
4954
var codes = browser.window.document.getElementsByTagName("code");
5055

5156
for (var i = 0; i < codes.length; i++) {
5257
assert.ok(codes[i].className.includes("language-"), "has a language");
5358

54-
if (codes[i].parentNode.nodeName === "pre") {
59+
if (codes[i].parentNode.nodeName === "PRE") {
5560
assert.ok(codes[i].parentNode.className.includes("language-"), "parent has a language");
5661
}
5762
}

0 commit comments

Comments
 (0)