[occur] proper session replacement
This commit is contained in:
parent
4b0b579bf4
commit
96bca7ed95
3 changed files with 27 additions and 31 deletions
|
|
@ -64,17 +64,17 @@ module.exports = {
|
|||
"test: display occurrences" : function() {
|
||||
var text = 'abc\ndef\nxyz\nbcx\n';
|
||||
editor.session.insert({row: 0, column: 0}, text);
|
||||
occur.display(editor, {needle: 'bc'});
|
||||
assert.equal(editor.getValue(), 'abc\nbcx\n');
|
||||
occur.displayOriginal(editor);
|
||||
occur.displayOccurContent(editor, {needle: 'bc'});
|
||||
assert.equal(editor.getValue(), 'abc\nbcx');
|
||||
occur.displayOriginalContent(editor);
|
||||
assert.equal(editor.getValue(), text);
|
||||
},
|
||||
|
||||
"test: original position from occur doc" : function() {
|
||||
var text = 'abc\ndef\nxyz\nbcx\n';
|
||||
editor.session.insert({row: 0, column: 0}, text);
|
||||
occur.display(editor, {needle: 'bc'});
|
||||
assert.equal(editor.getValue(), 'abc\nbcx\n');
|
||||
occur.displayOccurContent(editor, {needle: 'bc'});
|
||||
assert.equal(editor.getValue(), 'abc\nbcx');
|
||||
var pos = occur.occurToOriginalPosition(editor.session, {row: 1, column: 2});
|
||||
assert.position(pos, 3, 2);
|
||||
},
|
||||
|
|
@ -87,8 +87,7 @@ module.exports = {
|
|||
|
||||
// run occur for lines including 'o'
|
||||
editor.execCommand('occur', {needle: 'o'});
|
||||
assert.equal(editor.getValue(), 'lo\nwo\n');
|
||||
|
||||
assert.equal(editor.getValue(), 'lo\nwo');
|
||||
// command install OK?
|
||||
// assert.ok(editor.getReadOnly(), 'occur doc not marked as read only');
|
||||
assert.ok(editor.getKeyboardHandler().isOccurHandler, 'no occur handler installed');
|
||||
|
|
@ -113,7 +112,7 @@ module.exports = {
|
|||
|
||||
// run occur for lines including 'o'
|
||||
editor.execCommand('occur', {needle: 'o'});
|
||||
assert.equal(editor.getValue(), 'lo\nwo\n');
|
||||
assert.equal(editor.getValue(), 'lo\nwo');
|
||||
assert.position(editor.getCursorPosition(), 0, 1, 'original -> occur pos');
|
||||
|
||||
// move to second line and accept
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue