##// END OF EJS Templates
Update test to modify class config for default_cell_type
Thomas Kluyver -
Show More
@@ -48,7 +48,14 b' function($, utils) {'
48 });
48 });
49 };
49 };
50
50
51 /**
52 * Modify the config values stored. Update the local data immediately,
53 * send the change to the server, and use the updated data from the server
54 * when the reply comes.
55 */
51 ConfigSection.prototype.update = function(newdata) {
56 ConfigSection.prototype.update = function(newdata) {
57 $.extend(true, this.data, newdata); // true -> recursive update
58
52 var that = this;
59 var that = this;
53 return utils.promising_ajax(this.api_url(), {
60 return utils.promising_ajax(this.api_url(), {
54 processData: false,
61 processData: false,
@@ -97,6 +104,24 b' function($, utils) {'
97 return this._class_data()[key] || this.defaults[key];
104 return this._class_data()[key] || this.defaults[key];
98 };
105 };
99
106
107 /**
108 * Set a config value. Send the update to the server, and change our
109 * local copy of the data immediately.
110 * Returns a promise which is fulfilled when the server replies to the
111 * change.
112 */
113 ConfigWithDefaults.prototype.set = function(key, value) {
114 var d = {};
115 d[key] = value;
116 if (this.classname) {
117 var d2 = {};
118 d2[this.classname] = d;
119 return this.section.update(d2);
120 } else {
121 return this.section.update(d);
122 }
123 };
124
100 return {ConfigSection: ConfigSection,
125 return {ConfigSection: ConfigSection,
101 ConfigWithDefaults: ConfigWithDefaults,
126 ConfigWithDefaults: ConfigWithDefaults,
102 };
127 };
@@ -33,7 +33,7 b' casper.notebook_test(function () {'
33 });
33 });
34
34
35 this.thenEvaluate(function() {
35 this.thenEvaluate(function() {
36 IPython.notebook.default_cell_type = 'selected';
36 IPython.notebook.class_config.set('default_cell_type', 'selected');
37 });
37 });
38
38
39 this.then(function () {
39 this.then(function () {
@@ -47,7 +47,7 b' casper.notebook_test(function () {'
47 });
47 });
48
48
49 this.thenEvaluate(function() {
49 this.thenEvaluate(function() {
50 IPython.notebook.default_cell_type = 'above';
50 IPython.notebook.class_config.set('default_cell_type', 'above');
51 });
51 });
52
52
53 this.then(function () {
53 this.then(function () {
@@ -61,7 +61,7 b' casper.notebook_test(function () {'
61 });
61 });
62
62
63 this.thenEvaluate(function() {
63 this.thenEvaluate(function() {
64 IPython.notebook.default_cell_type = 'below';
64 IPython.notebook.class_config.set('default_cell_type', 'below');
65 });
65 });
66
66
67 this.then(function () {
67 this.then(function () {
General Comments 0
You need to be logged in to leave comments. Login now