diff --git a/demo_frame.js b/demo_frame.js
index b2e9805..e2631f1 100644
--- a/demo_frame.js
+++ b/demo_frame.js
@@ -30,9 +30,13 @@ module.exports = function(node) {
var html = getHTML.call(this, demoEl);
var js = getJS.call(this, sourceEl);
- var dataForHtml = node.querySelector("[data-for=html] > pre code, [data-for=html] > div > pre code");
- dataForHtml.innerHTML = escape(html);
- prettify(dataForHtml);
+ if (html && html.trim()) {
+ var dataForHtml = node.querySelector("[data-for=html] > pre code, [data-for=html] > div > pre code");
+ dataForHtml.innerHTML = escape(html);
+ prettify(dataForHtml);
+
+ show(node.querySelector("[data-tab=html]"));
+ }
if (js) {
var dataForJS = node.querySelector("[data-for=js] > pre code, [data-for=js] > div > pre code");
diff --git a/demo_frame.stache b/demo_frame.stache
deleted file mode 100644
index e7e4ef2..0000000
--- a/demo_frame.stache
+++ /dev/null
@@ -1,16 +0,0 @@
-
diff --git a/test.js b/test.js
index 6447235..2ca439c 100644
--- a/test.js
+++ b/test.js
@@ -281,6 +281,38 @@ describe("bit-docs-tag-demo", function() {
});
});
+ describe("without html", function() {
+ before(function() {
+ return ctx.browser.newPage().then(function(p) {
+ ctx.page = p;
+ return ctx.page.goto(
+ "http://127.0.0.1:8081/test/temp/withoutHtml.html"
+ );
+ });
+ });
+
+ after(function() {
+ return ctx.page.close().then(function() {
+ ctx.page = null;
+ });
+ });
+
+ describe("HTML", function() {
+ // expect no content
+ dataForHtml("");
+
+ it("tab is hidden", function() {
+ return ctx.page
+ .evaluate(function() {
+ return document.querySelector('[data-tab="html"]').style.display;
+ })
+ .then(function(display) {
+ assert.equal(display, "none", "html tab is hidden");
+ });
+ });
+ });
+ });
+
describe("without js", function() {
before(function() {
return ctx.browser.newPage().then(function(p) {
@@ -448,8 +480,8 @@ describe("bit-docs-tag-demo", function() {
};
})
.then(function(r) {
- assert.equal(r.wrappers, 6, "four wrappers exists");
- assert.equal(r.injected, 6, "four injected into wrappers");
+ assert.equal(r.wrappers, 7, "demo wrappers exist");
+ assert.equal(r.injected, 7, "demos injected into wrappers");
});
});
});
diff --git a/test/demos/demo-without-html.html b/test/demos/demo-without-html.html
new file mode 100644
index 0000000..7208343
--- /dev/null
+++ b/test/demos/demo-without-html.html
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/test/generate.js b/test/generate.js
index 171fd70..3294858 100644
--- a/test/generate.js
+++ b/test/generate.js
@@ -13,6 +13,7 @@ function makeWrapper(path) {
function allDemos() {
return [
"demo-with-ids",
+ "demo-without-html",
"demo-without-ids",
"demo-without-js",
"demo-complex",
@@ -30,6 +31,10 @@ var docMap = Promise.resolve({
name: "withIds",
body: makeWrapper("demo-with-ids")
},
+ withoutHtml: {
+ name: "withoutHtml",
+ body: makeWrapper("demo-without-html")
+ },
withoutIds: {
name: "withoutIds",
body: makeWrapper("demo-without-ids")