-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix bug with missing token in latex folding (#5093)
* fix bug with missing token * add test for latex folding Issue #5090
- Loading branch information
Showing
2 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
if (typeof process !== "undefined") require("amd-loader"); | ||
|
||
"use strict"; | ||
|
||
var LatexMode = require("../latex").Mode; | ||
var EditSession = require("../../edit_session").EditSession; | ||
var assert = require("../../test/assertions"); | ||
|
||
module.exports = { | ||
"test: latex block folding": function () { | ||
var session = new EditSession([ | ||
'\\usepackage{amsmath}', '\\title{\\LaTeX}', '\\date{}', '\\begin' | ||
]); | ||
|
||
var mode = new LatexMode(); | ||
session.setFoldStyle("markbegin"); | ||
session.setMode(mode); | ||
|
||
assert.equal(session.getFoldWidget(0), ""); | ||
assert.equal(session.getFoldWidget(1), ""); | ||
assert.equal(session.getFoldWidget(2), ""); | ||
assert.equal(session.getFoldWidget(3), "start"); | ||
assert.equal(session.getFoldWidgetRange(3), null); | ||
|
||
session.setValue(session.getValue() + '{test}\nsome text here \n\\end{test}'); | ||
|
||
assert.range(session.getFoldWidgetRange(3), 3, 12, 5, 0); | ||
} | ||
}; | ||
|
||
if (typeof module !== "undefined" && module === require.main) require("asyncjs").test.testcase(module.exports).exec(); |