mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: Autolinking to category using hashtags.
This commit is contained in:
parent
b8471177dc
commit
c1dbf5c1c4
20 changed files with 365 additions and 14 deletions
|
@ -158,3 +158,27 @@ test("defaultHomepage", function() {
|
|||
Discourse.SiteSettings.top_menu = "latest|top|hot";
|
||||
equal(utils.defaultHomepage(), "latest", "default homepage is the first item in the top_menu site setting");
|
||||
});
|
||||
|
||||
test("caretRowCol", () => {
|
||||
var textarea = document.createElement('textarea');
|
||||
const content = document.createTextNode("01234\n56789\n012345");
|
||||
textarea.appendChild(content);
|
||||
textarea.setAttribute('id', 'test');
|
||||
document.body.appendChild(textarea);
|
||||
|
||||
const assertResult = (setCaretPos, expectedRowNum, expectedColNum) => {
|
||||
Discourse.Utilities.setCaretPosition(textarea, setCaretPos);
|
||||
|
||||
const result = Discourse.Utilities.caretRowCol(textarea);
|
||||
equal(result.rowNum, expectedRowNum, "returns the right row of the caret");
|
||||
equal(result.colNum, expectedColNum, "returns the right col of the caret");
|
||||
};
|
||||
|
||||
assertResult(0, 1, 0);
|
||||
assertResult(5, 1, 5);
|
||||
assertResult(6, 2, 0);
|
||||
assertResult(11, 2, 5);
|
||||
assertResult(14, 3, 2);
|
||||
|
||||
document.body.removeChild(textarea);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue