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

Commit f50e376

Browse files
Fixes after second review
1 parent b507ad0 commit f50e376

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

src/language/HTMLUtils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ define(function (require, exports, module) {
407407

408408
// Check to see if this is the closing of a tag (either the start or end) closing tag
409409
if (ctx.token.string.charAt(0) === "<" && ctx.token.string.charAt(1) === "/") {
410-
return createTagInfo(CLOSING_TAG, offset + 2, ctx.token.string.slice(2));
410+
return createTagInfo(CLOSING_TAG, offset - 2, ctx.token.string.slice(2));
411411
}
412412

413413
// Make sure the cursor is not after an equal sign or a quote before we report the context as a tag.

test/spec/CodeHintUtils-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,14 +186,14 @@ define(function (require, exports, module) {
186186
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.TAG_NAME));
187187
});
188188

189-
it("should hint tagname for a closing tag", function () {
189+
it("should not hint anything inside a closing tag", function () {
190190
var pos = {"ch": 0, "line": 0};
191191
setContentAndUpdatePos(pos,
192192
["<html>", "<body>", "<div id='test' class='foo'></div>"],
193193
"</body></ht", "ml>");
194194

195195
var tag = HTMLUtils.getTagInfo(myEditor, pos);
196-
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.CLOSING_TAG, 6, "html"));
196+
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.CLOSING_TAG, 2, "html"));
197197
});
198198

199199
it("should find the tagname of the current tag if two tags are right next to each other", function () {

test/spec/InlineEditorProviders-test-files/test1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
<div{{0}} class="{{1}}foo" id="myDiv{{2}}">{{3}}</div>
99
<!--<div{{4}}>-->
1010
<div id="anotherDiv{{6}}"></div>
11-
<div{{8}} {{7}}class="foo"></div>
11+
<div{{8}} {{7}}class="foo"></{{9}}div>
1212
</body>
1313
</html>

test/spec/InlineEditorProviders-test.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ define(function (require, exports, module) {
252252
});
253253

254254

255-
it("should open a type selector", function () {
255+
it("should open a type selector on opening tag", function () {
256256
initInlineTest("test1.html", 0);
257257

258258
runs(function () {
@@ -263,6 +263,18 @@ define(function (require, exports, module) {
263263
expect(inlinePos).toEqual(this.infos["test1.css"].offsets[0]);
264264
});
265265
});
266+
267+
it("should open a type selector on closing tag", function () {
268+
initInlineTest("test1.html", 9);
269+
270+
runs(function () {
271+
var inlineWidget = EditorManager.getCurrentFullEditor().getInlineWidgets()[0];
272+
var inlinePos = inlineWidget.editors[0].getCursorPos();
273+
274+
// verify cursor position in inline editor
275+
expect(inlinePos).toEqual(this.infos["test1.css"].offsets[0]);
276+
});
277+
});
266278

267279
it("should open a class selector", function () {
268280
initInlineTest("test1.html", 1);

0 commit comments

Comments
 (0)