diff --git a/src/extensions/default/MDNDocs/unittest-files/test1.html b/src/extensions/default/MDNDocs/unittest-files/test1.html index 0c942431b3d..276b4ddf087 100644 --- a/src/extensions/default/MDNDocs/unittest-files/test1.html +++ b/src/extensions/default/MDNDocs/unittest-files/test1.html @@ -8,5 +8,10 @@ + <{{2}}nonexistent> +
{{3}}some text
+ +
+ \ No newline at end of file diff --git a/src/extensions/default/MDNDocs/unittests.js b/src/extensions/default/MDNDocs/unittests.js index 8a97926f59c..dadcf3bcff3 100644 --- a/src/extensions/default/MDNDocs/unittests.js +++ b/src/extensions/default/MDNDocs/unittests.js @@ -101,6 +101,22 @@ define(function (require, exports, module) { expect(Object.keys(json).length).toBeGreaterThan(0); }); }); + + it("should retrieve the HTML docs database", function () { + var json; + + runs(function () { + main._getDocs("html.json").done(function (result) { + json = result; + }); + }); + + waitsFor(function () { return json !== undefined; }, "read html.json database", 5000); + + runs(function () { + expect(Object.keys(json).length).toBeGreaterThan(0); + }); + }); }); @@ -165,9 +181,37 @@ define(function (require, exports, module) { queryInlineAtPos(testHTMLInfo, 0, true, "border"); }); - it("should open docs for HTML", function () { + it("should open docs when the selection is on an HTML tag", function () { queryInlineAtPos(testHTMLInfo, 1, true, ""); }); + + it("should not open docs when the selection is on an invalid HTML tag", function () { + queryInlineAtPos(testHTMLInfo, 2, false); + }); + + it("should not open docs when the selection is not an HTML tag", function () { + /* Text */ + queryInlineAtPos(testHTMLInfo, 3, false); + + /* Commented tag */ + queryInlineAtPos(testHTMLInfo, 4, false); + }); + + it("should open docs when the selection is on an HTML attribute", function () { + queryInlineAtPos(testHTMLInfo, 5, true, "
"); + }); + + it("should open docs for tag (fallback) when the selection is on an HTML attribute's value", function () { + queryInlineAtPos(testHTMLInfo, 6, true, "
"); + }); + + it("should open docs for tag (fallback) when the selection is on an invalid HTML attribute", function () { + queryInlineAtPos(testHTMLInfo, 7, true, "
"); + }); + + it("should not open docs when the selection is on an invalid HTML attribute on an invalid HTML tag", function () { + queryInlineAtPos(testHTMLInfo, 8, false); + }); });