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

Commit

Permalink
Fixes after second review
Browse files Browse the repository at this point in the history
  • Loading branch information
WebsiteDeveloper committed Apr 16, 2013
1 parent b507ad0 commit f50e376
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/language/HTMLUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ define(function (require, exports, module) {

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

// Make sure the cursor is not after an equal sign or a quote before we report the context as a tag.
Expand Down
4 changes: 2 additions & 2 deletions test/spec/CodeHintUtils-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ define(function (require, exports, module) {
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.TAG_NAME));
});

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

var tag = HTMLUtils.getTagInfo(myEditor, pos);
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.CLOSING_TAG, 6, "html"));
expect(tag).toEqual(HTMLUtils.createTagInfo(HTMLUtils.CLOSING_TAG, 2, "html"));
});

it("should find the tagname of the current tag if two tags are right next to each other", function () {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/InlineEditorProviders-test-files/test1.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
<div{{0}} class="{{1}}foo" id="myDiv{{2}}">{{3}}</div>
<!--<div{{4}}>-->
<div id="anotherDiv{{6}}"></div>
<div{{8}} {{7}}class="foo"></div>
<div{{8}} {{7}}class="foo"></{{9}}div>
</body>
</html>
14 changes: 13 additions & 1 deletion test/spec/InlineEditorProviders-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ define(function (require, exports, module) {
});


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

runs(function () {
Expand All @@ -263,6 +263,18 @@ define(function (require, exports, module) {
expect(inlinePos).toEqual(this.infos["test1.css"].offsets[0]);
});
});

it("should open a type selector on closing tag", function () {
initInlineTest("test1.html", 9);

runs(function () {
var inlineWidget = EditorManager.getCurrentFullEditor().getInlineWidgets()[0];
var inlinePos = inlineWidget.editors[0].getCursorPos();

// verify cursor position in inline editor
expect(inlinePos).toEqual(this.infos["test1.css"].offsets[0]);
});
});

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

0 comments on commit f50e376

Please sign in to comment.