Show More
@@ -120,16 +120,6 define([ | |||
|
120 | 120 | 'h' : 'ipython.show-keyboard-shortcut-help-dialog', |
|
121 | 121 | 'z' : 'ipython.undo-last-cell-deletion', |
|
122 | 122 | 'q' : 'ipython.close-pager', |
|
123 | 'i,e,e,e,e,e' : function(){console.log('[[===>>> 5E <<<===]]');}, | |
|
124 | 'i,d,d,q,d' : function(){console.log('[[===>>> Trigger god mode <<<===]]');}, | |
|
125 | 'i,d,d' : function(){console.log('[[===>>> should warn at registration <<<===]]');}, | |
|
126 | 'i,d,k' : function(){console.log('[[===>>> Trigger shadow mode <<<===]]');}, | |
|
127 | 'i,d,k,r,q' : function(){console.log('[[===>>> Trigger invisibility mode <<<===]]');}, | |
|
128 | ';,up,down,up,down,left,right,left,right,b,a' : function(){console.log('[[===>>> Konami <<<===]]');}, | |
|
129 | 'ctrl-x,meta-c,meta-b,u,t,t,e,r,f,l,y' : function(){ | |
|
130 | console.log('[[Are you a real Programmer ?]]'); | |
|
131 | window.open('http://xkcd.com/378/','_blank'); | |
|
132 | }, | |
|
133 | 123 | }; |
|
134 | 124 | }; |
|
135 | 125 |
@@ -13,7 +13,9 var to_normalize = [ | |||
|
13 | 13 | var unshifted = "` 1 2 3 4 5 6 7 8 9 0 - = q w e r t y u i o p [ ] \\ a s d f g h j k l ; ' z x c v b n m , . /"; |
|
14 | 14 | // shifted = '~ ! @ # $ % ^ & * ( ) _ + Q W E R T Y U I O P { } | A S D F G H J K L : " Z X C V B N M < > ?'; |
|
15 | 15 | |
|
16 | ||
|
16 | 17 | casper.notebook_test(function () { |
|
18 | var that = this; | |
|
17 | 19 | |
|
18 | 20 | this.then(function () { |
|
19 | 21 | this.each(unshifted.split(' '), function (self, item) { |
@@ -46,4 +48,37 casper.notebook_test(function () { | |||
|
46 | 48 | }); |
|
47 | 49 | }); |
|
48 | 50 | |
|
51 | this.then(function(){ | |
|
52 | ||
|
53 | var shortcuts_test = { | |
|
54 | 'i,e,e,e,e,e' : '[[5E]]', | |
|
55 | 'i,d,d,q,d' : '[[TEST1]]', | |
|
56 | 'i,d,d' : '[[TEST1 WILL BE SHADOWED]]', | |
|
57 | 'i,d,k' : '[[SHOULD SHADOW TEST2]]', | |
|
58 | 'i,d,k,r,q' : '[[TEST2 NOT SHADOWED]]', | |
|
59 | ';,up,down,up,down,left,right,left,right,b,a' : '[[KONAMI]]', | |
|
60 | 'ctrl-x,meta-c,meta-b,u,t,t,e,r,f,l,y' : '[[XKCD]]' | |
|
61 | ||
|
62 | }; | |
|
63 | ||
|
64 | that.msgs = []; | |
|
65 | that.on('remote.message', function(msg) { | |
|
66 | that.msgs.push(msg); | |
|
67 | }) | |
|
68 | that.evaluate(function (obj) { | |
|
69 | for(var k in obj){ | |
|
70 | IPython.keyboard_manager.command_shortcuts.add_shortcut(k, function(){console.log(obj[k])}); | |
|
71 | } | |
|
72 | }, shortcuts_test); | |
|
73 | ||
|
74 | var longer_first = false; | |
|
75 | var longer_last = false; | |
|
76 | for(var m in that.msgs){ | |
|
77 | longer_first = longer_first||(that.msgs[m].match(/you are overriting/)!= null); | |
|
78 | longer_last = longer_last ||(that.msgs[m].match(/will be shadowed/) != null); | |
|
79 | } | |
|
80 | this.test.assert(longer_first, 'no warnign if registering shorter shortut'); | |
|
81 | this.test.assert(longer_last , 'no warnign if registering longer shortut'); | |
|
82 | }) | |
|
83 | ||
|
49 | 84 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now