Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Migrated missing Quick Docs Tests from PR #10036 #13285

Merged
merged 1 commit into from
Apr 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/extensions/default/MDNDocs/unittest-files/test1.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
</style>
</head>
<body style="background-color{{1}}: #000">
<{{2}}nonexistent></nonexistent>
<div>{{3}}some text</div>
<!-- <{{4}}div></div> -->
<div {{5}}class="{{6}}muted" {{7}}nonexistent="false"></div>
<nonexistent {{8}}nonexistent="false"></nonexistent>
</body>
</html>
46 changes: 45 additions & 1 deletion src/extensions/default/MDNDocs/unittests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

});

Expand Down Expand Up @@ -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, "<body>");
});

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, "<div>");
});

it("should open docs for tag (fallback) when the selection is on an HTML attribute's value", function () {
queryInlineAtPos(testHTMLInfo, 6, true, "<div>");
});

it("should open docs for tag (fallback) when the selection is on an invalid HTML attribute", function () {
queryInlineAtPos(testHTMLInfo, 7, true, "<div>");
});

it("should not open docs when the selection is on an invalid HTML attribute on an invalid HTML tag", function () {
queryInlineAtPos(testHTMLInfo, 8, false);
});

});

Expand Down