mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-12 11:45:38 +08:00
Update test to modify class config for default_cell_type
This commit is contained in:
parent
7f221537d4
commit
95e60a544c
@ -48,7 +48,14 @@ function($, utils) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Modify the config values stored. Update the local data immediately,
|
||||
* send the change to the server, and use the updated data from the server
|
||||
* when the reply comes.
|
||||
*/
|
||||
ConfigSection.prototype.update = function(newdata) {
|
||||
$.extend(true, this.data, newdata); // true -> recursive update
|
||||
|
||||
var that = this;
|
||||
return utils.promising_ajax(this.api_url(), {
|
||||
processData: false,
|
||||
@ -97,6 +104,24 @@ function($, utils) {
|
||||
return this._class_data()[key] || this.defaults[key];
|
||||
};
|
||||
|
||||
/**
|
||||
* Set a config value. Send the update to the server, and change our
|
||||
* local copy of the data immediately.
|
||||
* Returns a promise which is fulfilled when the server replies to the
|
||||
* change.
|
||||
*/
|
||||
ConfigWithDefaults.prototype.set = function(key, value) {
|
||||
var d = {};
|
||||
d[key] = value;
|
||||
if (this.classname) {
|
||||
var d2 = {};
|
||||
d2[this.classname] = d;
|
||||
return this.section.update(d2);
|
||||
} else {
|
||||
return this.section.update(d);
|
||||
}
|
||||
};
|
||||
|
||||
return {ConfigSection: ConfigSection,
|
||||
ConfigWithDefaults: ConfigWithDefaults,
|
||||
};
|
||||
|
@ -33,7 +33,7 @@ casper.notebook_test(function () {
|
||||
});
|
||||
|
||||
this.thenEvaluate(function() {
|
||||
IPython.notebook.default_cell_type = 'selected';
|
||||
IPython.notebook.class_config.set('default_cell_type', 'selected');
|
||||
});
|
||||
|
||||
this.then(function () {
|
||||
@ -47,7 +47,7 @@ casper.notebook_test(function () {
|
||||
});
|
||||
|
||||
this.thenEvaluate(function() {
|
||||
IPython.notebook.default_cell_type = 'above';
|
||||
IPython.notebook.class_config.set('default_cell_type', 'above');
|
||||
});
|
||||
|
||||
this.then(function () {
|
||||
@ -61,7 +61,7 @@ casper.notebook_test(function () {
|
||||
});
|
||||
|
||||
this.thenEvaluate(function() {
|
||||
IPython.notebook.default_cell_type = 'below';
|
||||
IPython.notebook.class_config.set('default_cell_type', 'below');
|
||||
});
|
||||
|
||||
this.then(function () {
|
||||
|
Loading…
Reference in New Issue
Block a user