From 0f307f28f19ee56ce8d8a22551e6aef76c2222ee Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Tue, 11 Aug 2015 15:26:46 -0700 Subject: [PATCH] cleanup stuff and fix tests --- notebook/static/base/less/variables.less | 4 ++- notebook/static/notebook/js/actions.js | 2 -- notebook/static/notebook/js/notebook.js | 3 +-- notebook/static/notebook/less/notebook.less | 28 +++------------------ notebook/tests/base/keyboard.js | 9 ++++++- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/notebook/static/base/less/variables.less b/notebook/static/base/less/variables.less index e5d1640c6..4cddd082a 100644 --- a/notebook/static/base/less/variables.less +++ b/notebook/static/base/less/variables.less @@ -15,6 +15,9 @@ @border-radius-base: 2px; @border-radius-large: 3px; @grid-gutter-width: 0px; +@kbd-color: #888; +@kbd-bg: transparent; + @icon-font-path: "../components/bootstrap/fonts/"; // Disable modal slide-in from top animation. @@ -57,4 +60,3 @@ label { // preven container size to jump from 768px to 720px // when window width go from 768 to 769+ @container-sm : @screen-sm-min; - diff --git a/notebook/static/notebook/js/actions.js b/notebook/static/notebook/js/actions.js index 5d4901a9f..fe3d21ba5 100644 --- a/notebook/static/notebook/js/actions.js +++ b/notebook/static/notebook/js/actions.js @@ -4,8 +4,6 @@ define(function(require){ "use strict"; - var dialog = require("base/js/dialog"); - var ActionHandler = function (env) { this.env = env || {}; Object.seal(this); diff --git a/notebook/static/notebook/js/notebook.js b/notebook/static/notebook/js/notebook.js index 4084b8959..99a137c68 100644 --- a/notebook/static/notebook/js/notebook.js +++ b/notebook/static/notebook/js/notebook.js @@ -172,8 +172,7 @@ define(function (require) { // ii) to prevent the div from scrolling up when the last cell is being // edited, but is too low on the page, which browsers will do automatically. var end_space = $('
') - .addClass('end_space') - .html('Cmd-Shift-P for Command palette'); + .addClass('end_space'); end_space.dblclick(function (e) { var ncells = that.ncells(); that.insert_cell_below('code',ncells-1); diff --git a/notebook/static/notebook/less/notebook.less b/notebook/static/notebook/less/notebook.less index f98908039..d80ef1117 100644 --- a/notebook/static/notebook/less/notebook.less +++ b/notebook/static/notebook/less/notebook.less @@ -96,38 +96,19 @@ p { .command-shortcut:before{ content:"(command)"; padding-right:3px; - color:#ccc + color:@gray-light; } .edit-shortcut:before{ content:"(edit)"; padding-right:3px; - color:#ccc -} - -.end_space { - - margin-left: auto; - margin-right:auto; - margin-top:50px; - font-size: 20pt; - font-weight: bold; - width:500px; - color: #aaa; - - & kbd { - color: #aaa; - border-color: #aaa; - } - + color:@gray-light; } kbd { - background: transparent; - border: 1px solid #888; + border-style: solid; + border-width: 1px; box-shadow: none; - border-radius: 3px; - color: #888; margin: 2px; padding-left: 2px; padding-right: 2px; @@ -138,7 +119,6 @@ kbd { ul.typeahead-list i{ margin-left: -10px; width: 18px; - border: thin solid transparent; } ul.typeahead-list { diff --git a/notebook/tests/base/keyboard.js b/notebook/tests/base/keyboard.js index 0c50cf047..c06171af0 100644 --- a/notebook/tests/base/keyboard.js +++ b/notebook/tests/base/keyboard.js @@ -13,6 +13,13 @@ var to_normalize = [ 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 , . /"; // 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 < > ?'; +var ambiguous_expect = function(ch){ + // `-` is ambiguous in shortcut context as a separator, so map it to `minus` + if(ch === '-'){ + return 'minus'; + } + return ch; +}; casper.notebook_test(function () { var that = this; @@ -24,7 +31,7 @@ casper.notebook_test(function () { var sc2 = IPython.keyboard.event_to_shortcut(e); return sc2; }, item); - this.test.assertEquals(result, item, 'Shortcut to event roundtrip: '+item); + this.test.assertEquals(result, ambiguous_expect(item), 'Shortcut to event roundtrip: '+item); }); });