-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1423,6 +1423,66 @@ define(function (require, exports, module) { | |
expect(/_modules\/Foo-Foo\$&/i.test(myEditor.getSelectedText())).toBe(true); | ||
}); | ||
}); | ||
|
||
it("should replace a string with \\r\\n\\t chars", function () { | ||
runs(function () { | ||
twCommandManager.execute(Commands.CMD_REPLACE); | ||
enterSearchText("Foo"); | ||
enterReplaceText("\\r\\n\\t"); | ||
|
||
var expectedMatch = {start: {line: LINE_FIRST_REQUIRE, ch: 8}, end: {line: LINE_FIRST_REQUIRE, ch: 11}}; | ||
|
||
expectSelection(expectedMatch); | ||
expect(/Foo/.test(myEditor.getSelectedText())).toBe(true); | ||
|
||
expect(tw$("#replace-yes").is(":enabled")).toBe(true); | ||
tw$("#replace-yes").click(); | ||
|
||
myEditor.setSelection({line: LINE_FIRST_REQUIRE, ch: 8}, {line: LINE_FIRST_REQUIRE, ch: 14}); | ||
expect(myEditor.getSelectedText()).toEqual("\\r\\n\\t"); | ||
}); | ||
}); | ||
|
||
it("should replace a string with \\r\\n\\t chars in regex mode", function () { | ||
runs(function () { | ||
twCommandManager.execute(Commands.CMD_REPLACE); | ||
toggleRegexp(true); | ||
enterSearchText("Foo"); | ||
enterReplaceText("\\\\r\\\\n\\\\t"); | ||
|
||
var expectedMatch = {start: {line: LINE_FIRST_REQUIRE, ch: 8}, end: {line: LINE_FIRST_REQUIRE, ch: 11}}; | ||
|
||
expectSelection(expectedMatch); | ||
expect(/Foo/.test(myEditor.getSelectedText())).toBe(true); | ||
|
||
expect(tw$("#replace-yes").is(":enabled")).toBe(true); | ||
tw$("#replace-yes").click(); | ||
|
||
myEditor.setSelection({line: LINE_FIRST_REQUIRE, ch: 8}, {line: LINE_FIRST_REQUIRE, ch: 14}); | ||
expect(myEditor.getSelectedText()).toEqual("\\r\\n\\t"); | ||
}); | ||
}); | ||
|
||
it("should replace a string with a new line and a tab in regex mode", function () { | ||
runs(function () { | ||
twCommandManager.execute(Commands.CMD_REPLACE); | ||
toggleRegexp(true); | ||
enterSearchText("Foo"); | ||
enterReplaceText("\\r\\n\\t"); | ||
|
||
var expectedMatch = {start: {line: LINE_FIRST_REQUIRE, ch: 8}, end: {line: LINE_FIRST_REQUIRE, ch: 11}}; | ||
|
||
expectSelection(expectedMatch); | ||
expect(/Foo/.test(myEditor.getSelectedText())).toBe(true); | ||
|
||
expect(tw$("#replace-yes").is(":enabled")).toBe(true); | ||
tw$("#replace-yes").click(); | ||
|
||
myEditor.setSelection({line: LINE_FIRST_REQUIRE, ch: 8}, {line: LINE_FIRST_REQUIRE + 1, ch: 3}); | ||
// FIXME: How can be the original line endings converted to \r\n? | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ficristo
Author
Collaborator
|
||
expect(myEditor.getSelectedText()).toEqual("\n\t ="); | ||
}); | ||
}); | ||
}); | ||
|
||
|
||
|
@redmunds Is there an api to easily change the line endings?