[occur] make occur doc react to keyboard evts / highlight it
This commit is contained in:
parent
8102b6579f
commit
0aee413754
3 changed files with 17 additions and 2 deletions
|
|
@ -71,17 +71,28 @@ module.exports = {
|
|||
},
|
||||
|
||||
"test: occur command" : function() {
|
||||
// setup
|
||||
var lines = ['hel', 'lo', '', 'wo', 'rld'];
|
||||
session.doc.insertLines(0, lines);
|
||||
editor.commands.addCommands(occurCommands);
|
||||
|
||||
// run occur for lines including 'o'
|
||||
editor.execCommand('occur', {needle: 'o'});
|
||||
assert.equal(session.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');
|
||||
assert.ok(editor.commands.byName.occurexit, 'no exitoccur command installed');
|
||||
|
||||
// exit occur
|
||||
editor.execCommand('occurexit');
|
||||
assert.equal(session.getValue(), lines.join('\n') + '\n');
|
||||
|
||||
// editor state cleaned up?
|
||||
assert.ok(!editor.getReadOnly(), 'original doc is marked as read only');
|
||||
assert.ok(!editor.getKeyboardHandler().isOccurHandler, 'occur handler installed after detach');
|
||||
assert.ok(!editor.commands.byName.occurexit, 'exitoccur installed after exiting occur');
|
||||
assert.equal(session.getValue(), lines.join('\n') + '\n');
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue