-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selection Range support. Part of Microsoft/vscode#65925 #46
Conversation
|
||
suite('HTML SelectionRange', () => { | ||
test('Basic', () => { | ||
assertRanges('<div|>foo</div>', [[1, 4], [0, 14]]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't [1,4] be [1,3]?
For readability, maybe format the expected ranges like [ "1:div", "0:<div>foo</div>"]
content = content.substr(0, offset) + content.substr(offset + 1); | ||
|
||
const document = TextDocument.create('test://foo/bar.html', 'html', 1, content); | ||
const actualRanges = getApplicableRanges(document, document.positionAt(offset)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally write the tests against the public API (htmlLanguageService.getSelectionRanges), that way we are sure it works end-to-end and the implementation can be changed freely without impacting any tests.
assertRanges('<div>foo</|div>', [[10, 13], [0, 14]]); | ||
assertRanges('<div>foo</di|v>', [[10, 13], [0, 14]]); | ||
assertRanges('<div>foo</div|>', [[10, 13], [0, 14]]); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also test self closed tags (<div foo="sdsdd"/>
)
test('Multiple Attribute Value', () => { | ||
assertRanges('<div class="foo" id="|bar">foo</div>', [[21, 24], [20, 25], [17, 25], [1, 25], [0, 35]]); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test comments and doctypes as well
Nice work! |
@aeschli Thanks! Addressed all your comments. |
No description provided.