[occur] make occur doc react to keyboard evts / highlight it

This commit is contained in:
Robert Krahn 2013-03-17 03:15:12 -07:00
commit 0aee413754
3 changed files with 17 additions and 2 deletions

View file

@ -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');
}
};