##// END OF EJS Templates
Some JS test fixes
Jonathan Frederic -
Show More
@@ -7,7 +7,8 b' define(['
7 7 ], function(IPython, $) {
8 8 "use strict";
9 9
10 var modal = function (options, keyboard_manager, notebook) {
10 var modal = function (options) {
11
11 12 var modal = $("<div/>")
12 13 .addClass("modal")
13 14 .addClass("fade")
@@ -72,16 +73,18 b' define(['
72 73 });
73 74 }
74 75 modal.on("hidden.bs.modal", function () {
75 if (notebook) {
76 var cell = notebook.get_selected_cell();
76 if (options.notebook) {
77 var cell = options.notebook.get_selected_cell();
77 78 if (cell) cell.select();
78 keyboard_manager.enable();
79 keyboard_manager.command_mode();
79 if (options.keyboard_manager) {
80 options.keyboard_manager.enable();
81 options.keyboard_manager.command_mode();
82 }
80 83 }
81 84 });
82 85
83 if (keyboard_manager) {
84 keyboard_manager.disable();
86 if (options.keyboard_manager) {
87 options.keyboard_manager.disable();
85 88 }
86 89
87 90 return modal.modal(options);
@@ -110,8 +110,12 b' define(['
110 110 return sanitized;
111 111 };
112 112
113 return {
113 var security = {
114 114 caja: caja,
115 115 sanitize_html: sanitize_html
116 116 };
117
118 IPython.security = security;
119
120 return security;
117 121 });
@@ -1,12 +1,12 b''
1 1 // Copyright (c) IPython Development Team.
2 2 // Distributed under the terms of the Modified BSD License.
3 3
4 var ipython = ipython || {};
5 4 require([
6 5 'base/js/namespace',
7 6 'jquery',
8 7 'notebook/js/notebook',
9 8 'base/js/utils',
9 'base/js/keyboard',
10 10 'base/js/page',
11 11 'notebook/js/layoutmanager',
12 12 'base/js/events',
@@ -24,6 +24,7 b' require(['
24 24 $,
25 25 notebook,
26 26 utils,
27 keyboard,
27 28 page,
28 29 layoutmanager,
29 30 events,
@@ -71,7 +72,8 b' require(['
71 72 events: events});
72 73 var quick_help = new quickhelp.QuickHelp({
73 74 keyboard_manager: keyboard_manager,
74 events: events});
75 events: events,
76 notebook: notebook});
75 77 var menubar = new menubar.MenuBar('#menubar', $.extend({
76 78 notebook: notebook,
77 79 layout_manager: layout_manager,
@@ -83,7 +85,8 b' require(['
83 85 '#notification_area', {
84 86 events: events,
85 87 save_widget: save_widget,
86 notebook: notebook});
88 notebook: notebook,
89 keyboard_manager: keyboard_manager});
87 90 notification_area.init_notification_widgets();
88 91
89 92 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
@@ -116,17 +119,18 b' require(['
116 119 events.trigger('app_initialized.NotebookApp');
117 120 notebook.load_notebook(common_options.notebook_name, common_options.notebook_path);
118 121
119 ipython.page = page;
120 ipython.layout_manager = layout_manager;
121 ipython.notebook = notebook;
122 ipython.pager = pager;
123 ipython.quick_help = quick_help;
124 ipython.login_widget = login_widget;
125 ipython.menubar = menubar;
126 ipython.toolbar = toolbar;
127 ipython.notification_area = notification_area;
128 ipython.events = events;
129 ipython.keyboard_manager = keyboard_manager;
130 ipython.save_widget = save_widget;
131 ipython.config = user_config;
122 IPython.page = page;
123 IPython.layout_manager = layout_manager;
124 IPython.notebook = notebook;
125 IPython.pager = pager;
126 IPython.quick_help = quick_help;
127 IPython.login_widget = login_widget;
128 IPython.menubar = menubar;
129 IPython.toolbar = toolbar;
130 IPython.notification_area = notification_area;
131 IPython.events = events;
132 IPython.keyboard_manager = keyboard_manager;
133 IPython.save_widget = save_widget;
134 IPython.config = user_config;
135 IPython.keyboard = keyboard;
132 136 });
@@ -190,6 +190,8 b' define(['
190 190
191 191 this.events.on('status_autorestarting.Kernel', function () {
192 192 dialog.modal({
193 notebook: that,
194 keyboard_manager: that.keyboard_manager,
193 195 title: "Kernel Restarting",
194 196 body: "The kernel appears to have died. It will restart automatically.",
195 197 buttons: {
@@ -1476,10 +1478,10 b' define(['
1476 1478 * @method start_session
1477 1479 */
1478 1480 Notebook.prototype.start_session = function () {
1479 this.session = new session.Session(this, {
1480 base_url: base_url,
1481 notebook_path: notebook_path,
1482 notebook_name: notebook_name,
1481 this.session = new session.Session({
1482 base_url: this.base_url,
1483 notebook_path: this.notebook_path,
1484 notebook_name: this.notebook_name,
1483 1485 notebook: this});
1484 1486 this.session.start($.proxy(this._session_started, this));
1485 1487 };
@@ -1509,6 +1511,8 b' define(['
1509 1511 Notebook.prototype.restart_kernel = function () {
1510 1512 var that = this;
1511 1513 dialog.modal({
1514 notebook: this,
1515 keyboard_manager: this.keyboard_manager,
1512 1516 title : "Restart kernel or continue running?",
1513 1517 body : $("<p/>").text(
1514 1518 'Do you want to restart the current kernel? You will lose all variables defined in it.'
@@ -1732,6 +1736,8 b' define(['
1732 1736 }
1733 1737 if (content.worksheets.length > 1) {
1734 1738 dialog.modal({
1739 notebook: this,
1740 keyboard_manager: this.keyboard_manager,
1735 1741 title : "Multiple worksheets",
1736 1742 body : "This notebook has " + data.worksheets.length + " worksheets, " +
1737 1743 "but this version of IPython can only handle the first. " +
@@ -1920,6 +1926,8 b' define(['
1920 1926
1921 1927 var nb = this;
1922 1928 dialog.modal({
1929 notebook: this,
1930 keyboard_manager: this.keyboard_manager,
1923 1931 title: "Trust this notebook?",
1924 1932 body: body,
1925 1933
@@ -2065,6 +2073,8 b' define(['
2065 2073 );
2066 2074 this.events.trigger('notebook_rename_failed.Notebook', [xhr, status, error]);
2067 2075 dialog.modal({
2076 notebook: this,
2077 keyboard_manager: this.keyboard_manager,
2068 2078 title: "Notebook Rename Error!",
2069 2079 body: dialog_body,
2070 2080 buttons : {
@@ -2146,6 +2156,8 b' define(['
2146 2156 "may not be able to read it. To keep the older version, close the " +
2147 2157 "notebook without saving it.";
2148 2158 dialog.modal({
2159 notebook: this,
2160 keyboard_manager: this.keyboard_manager,
2149 2161 title : "Notebook converted",
2150 2162 body : msg,
2151 2163 buttons : {
@@ -2163,6 +2175,8 b' define(['
2163 2175 "introduced in later notebook versions may not be available.";
2164 2176
2165 2177 dialog.modal({
2178 notebook: this,
2179 keyboard_manager: this.keyboard_manager,
2166 2180 title : "Newer Notebook",
2167 2181 body : msg,
2168 2182 buttons : {
@@ -2214,6 +2228,8 b' define(['
2214 2228 "v" + this.nbformat + " or earlier.";
2215 2229 }
2216 2230 dialog.modal({
2231 notebook: this,
2232 keyboard_manager: this.keyboard_manager,
2217 2233 title: "Error loading notebook",
2218 2234 body : msg,
2219 2235 buttons : {
@@ -2378,6 +2394,8 b' define(['
2378 2394 );
2379 2395
2380 2396 dialog.modal({
2397 notebook: this,
2398 keyboard_manager: this.keyboard_manager,
2381 2399 title : "Revert notebook to checkpoint",
2382 2400 body : body,
2383 2401 buttons : {
@@ -24,6 +24,7 b' define(['
24 24 this.events = options.events;
25 25 this.save_widget = options.save_widget;
26 26 this.notebook = options.notebook;
27 this.keyboard_manager = options.keyboard_manager;
27 28 if (this.selector !== undefined) {
28 29 this.element = $(selector);
29 30 }
@@ -135,6 +136,8 b' define(['
135 136 dialog.modal({
136 137 title: "Dead kernel",
137 138 body : msg,
139 keyboard_manager: that.keyboard_manager,
140 notebook: that.notebook,
138 141 buttons : {
139 142 "Manual Restart": {
140 143 class: "btn-danger",
@@ -167,6 +170,8 b' define(['
167 170 dialog.modal({
168 171 title: "WebSocket connection failed",
169 172 body: msg,
173 keyboard_manager: that.keyboard_manager,
174 notebook: that.notebook,
170 175 buttons : {
171 176 "OK": {},
172 177 "Reconnect": {
@@ -18,7 +18,9 b' define(['
18 18 // Dictionary of keyword arguments.
19 19 // events: $(Events) instance
20 20 // keyboard_manager: KeyboardManager instance
21 // notebook: Notebook instance
21 22 this.keyboard_manager = options.keyboard_manager;
23 this.notebook = options.notebook;
22 24 this.keyboard_manager.quick_help = this;
23 25 this.events = options.events;
24 26 };
@@ -112,7 +114,9 b' define(['
112 114 destroy : false,
113 115 buttons : {
114 116 Close : {}
115 }
117 },
118 notebook: this.notebook,
119 keyboard_manager: this.keyboard_manager,
116 120 });
117 121 this.shortcut_dialog.addClass("modal_stretch");
118 122
@@ -44,7 +44,7 b' define(['
44 44 Cell.apply(this, [{
45 45 config: config,
46 46 keyboard_manager: options.keyboard_manager,
47 events: events}]);
47 events: this.events}]);
48 48
49 49 this.cell_type = this.cell_type || 'text';
50 50 mathjaxutils = mathjaxutils;
@@ -4,7 +4,7 b''
4 4 define([
5 5 'base/js/namespace',
6 6 'jquery',
7 'components/bootstrap-tour/build/js/bootstrap-tour.min',
7 'bootstraptour',
8 8 ], function(IPython, $, Tour) {
9 9 "use strict";
10 10
@@ -13,9 +13,9 b' define(['
13 13 this.kernel = null;
14 14 this.id = null;
15 15 this.notebook = options.notebook;
16 this.name = notebook.notebook_name;
17 this.path = notebook.notebook_path;
18 this.base_url = notebook.base_url;
16 this.name = options.notebook_name;
17 this.path = options.notebook_path;
18 this.base_url = options.base_url;
19 19 };
20 20
21 21 Session.prototype.start = function(callback) {
@@ -23,6 +23,7 b''
23 23 underscore : 'components/underscore/underscore-min',
24 24 backbone : 'components/backbone/backbone-min',
25 25 jquery: 'components/jquery/jquery.min',
26 bootstraptour: 'components/bootstrap-tour/build/js/bootstrap-tour.min',
26 27 },
27 28 shim: {
28 29 underscore: {
@@ -31,6 +32,9 b''
31 32 backbone: {
32 33 deps: ["underscore", "jquery"],
33 34 exports: "Backbone"
35 },
36 bootstraptour: {
37 exports: "Tour"
34 38 }
35 39 }
36 40 });
@@ -12,6 +12,7 b' casper.open_new_notebook = function () {'
12 12 // Create and open a new notebook.
13 13 var baseUrl = this.get_notebook_server();
14 14 this.start(baseUrl);
15 this.waitFor(this.page_loaded);
15 16 this.thenClick('button#new_notebook');
16 17 this.waitForPopup('');
17 18
@@ -19,11 +20,13 b' casper.open_new_notebook = function () {'
19 20 this.then(function () {
20 21 this.open(this.popups[0].url);
21 22 });
23 this.waitFor(this.page_loaded);
22 24
23 25 // Make sure the kernel has started
24 this.waitFor( this.kernel_running );
26 this.waitFor(this.kernel_running);
25 27 // track the IPython busy/idle state
26 28 this.thenEvaluate(function () {
29 IPython._status = 'idle';
27 30 $([IPython.events]).on('status_idle.Kernel',function () {
28 31 IPython._status = 'idle';
29 32 });
@@ -42,9 +45,18 b' casper.open_new_notebook = function () {'
42 45 });
43 46 };
44 47
45 casper.kernel_running = function kernel_running() {
48 casper.page_loaded = function() {
46 49 // Return whether or not the kernel is running.
47 return this.evaluate(function kernel_running() {
50 return this.evaluate(function() {
51 return IPython !== undefined &&
52 IPython.page !== undefined &&
53 IPython.events !== undefined;
54 });
55 };
56
57 casper.kernel_running = function() {
58 // Return whether or not the kernel is running.
59 return this.evaluate(function() {
48 60 return IPython.notebook.kernel.running;
49 61 });
50 62 };
@@ -503,6 +515,7 b' casper.open_dashboard = function () {'
503 515 // Start casper by opening the dashboard page.
504 516 var baseUrl = this.get_notebook_server();
505 517 this.start(baseUrl);
518 this.waitFor(this.page_loaded);
506 519 this.wait_for_dashboard();
507 520 };
508 521
General Comments 0
You need to be logged in to leave comments. Login now