##// END OF EJS Templates
Backport PR #6653: Fix IPython.utils.ansispan() to ignore stray [0m...
Backport PR #6653: Fix IPython.utils.ansispan() to ignore stray [0m Previously, `IPython.utils.fixConsole("\033[0m")` (I use `fixConsole()` because `ansispan()` is private) gave `"</span>"`. I also changed `ansiyellow` to something that looks actually yellow (but still dark). I'm submitting this to `master`, but it would be good to backport this to 2.x (whatever the procedure is).

File last commit:

r19030:9d3e3ae5
r20381:96f47674
Show More
prompt_numbers.js
36 lines | 1.3 KiB | application/javascript | JavascriptLexer
// Test
casper.notebook_test(function () {
var that = this;
var set_prompt = function (i, val) {
that.evaluate(function (i, val) {
var cell = IPython.notebook.get_cell(i);
cell.set_input_prompt(val);
}, [i, val]);
};
var get_prompt = function (i) {
return that.evaluate(function (i) {
var elem = IPython.notebook.get_cell(i).element;
return elem.find('div.input_prompt').html();
}, [i]);
};
this.then(function () {
var a = 'print("a")';
var index = this.append_cell(a);
this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp; by default");
set_prompt(index, 2);
this.test.assertEquals(get_prompt(index), "In&nbsp;[2]:", "prompt number is 2");
set_prompt(index, 0);
this.test.assertEquals(get_prompt(index), "In&nbsp;[0]:", "prompt number is 0");
set_prompt(index, "*");
this.test.assertEquals(get_prompt(index), "In&nbsp;[*]:", "prompt number is *");
set_prompt(index, undefined);
this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
set_prompt(index, null);
this.test.assertEquals(get_prompt(index), "In&nbsp;[&nbsp;]:", "prompt number is &nbsp;");
});
});