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

Commit 0881dd0

Browse files
saurabh95ficristo
authored andcommitted
Migrated missing Quick Docs Tests from PR #10036 (#13285)
1 parent fe3a965 commit 0881dd0

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

src/extensions/default/MDNDocs/unittest-files/test1.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@
88
</style>
99
</head>
1010
<body style="background-color{{1}}: #000">
11+
<{{2}}nonexistent></nonexistent>
12+
<div>{{3}}some text</div>
13+
<!-- <{{4}}div></div> -->
14+
<div {{5}}class="{{6}}muted" {{7}}nonexistent="false"></div>
15+
<nonexistent {{8}}nonexistent="false"></nonexistent>
1116
</body>
1217
</html>

src/extensions/default/MDNDocs/unittests.js

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,22 @@ define(function (require, exports, module) {
101101
expect(Object.keys(json).length).toBeGreaterThan(0);
102102
});
103103
});
104+
105+
it("should retrieve the HTML docs database", function () {
106+
var json;
107+
108+
runs(function () {
109+
main._getDocs("html.json").done(function (result) {
110+
json = result;
111+
});
112+
});
113+
114+
waitsFor(function () { return json !== undefined; }, "read html.json database", 5000);
115+
116+
runs(function () {
117+
expect(Object.keys(json).length).toBeGreaterThan(0);
118+
});
119+
});
104120

105121
});
106122

@@ -165,9 +181,37 @@ define(function (require, exports, module) {
165181
queryInlineAtPos(testHTMLInfo, 0, true, "border");
166182
});
167183

168-
it("should open docs for HTML", function () {
184+
it("should open docs when the selection is on an HTML tag", function () {
169185
queryInlineAtPos(testHTMLInfo, 1, true, "<body>");
170186
});
187+
188+
it("should not open docs when the selection is on an invalid HTML tag", function () {
189+
queryInlineAtPos(testHTMLInfo, 2, false);
190+
});
191+
192+
it("should not open docs when the selection is not an HTML tag", function () {
193+
/* Text */
194+
queryInlineAtPos(testHTMLInfo, 3, false);
195+
196+
/* Commented tag */
197+
queryInlineAtPos(testHTMLInfo, 4, false);
198+
});
199+
200+
it("should open docs when the selection is on an HTML attribute", function () {
201+
queryInlineAtPos(testHTMLInfo, 5, true, "<div>");
202+
});
203+
204+
it("should open docs for tag (fallback) when the selection is on an HTML attribute's value", function () {
205+
queryInlineAtPos(testHTMLInfo, 6, true, "<div>");
206+
});
207+
208+
it("should open docs for tag (fallback) when the selection is on an invalid HTML attribute", function () {
209+
queryInlineAtPos(testHTMLInfo, 7, true, "<div>");
210+
});
211+
212+
it("should not open docs when the selection is on an invalid HTML attribute on an invalid HTML tag", function () {
213+
queryInlineAtPos(testHTMLInfo, 8, false);
214+
});
171215

172216
});
173217

0 commit comments

Comments
 (0)