Show More
@@ -0,0 +1,36 b'' | |||
|
1 | ||
|
2 | // Test | |
|
3 | casper.notebook_test(function () { | |
|
4 | ||
|
5 | var that = this; | |
|
6 | var set_prompt = function (i, val) { | |
|
7 | that.evaluate(function (i, val) { | |
|
8 | var cell = IPython.notebook.get_cell(i); | |
|
9 | cell.set_input_prompt(val); | |
|
10 | }, [i, val]); | |
|
11 | }; | |
|
12 | ||
|
13 | var get_prompt = function (i) { | |
|
14 | return that.evaluate(function (i) { | |
|
15 | var elem = IPython.notebook.get_cell(i).element; | |
|
16 | return elem.find('div.input_prompt').html(); | |
|
17 | }, [i]); | |
|
18 | }; | |
|
19 | ||
|
20 | this.then(function () { | |
|
21 | var a = 'print("a")'; | |
|
22 | var index = this.append_cell(a); | |
|
23 | ||
|
24 | this.test.assertEquals(get_prompt(index), "In [ ]:", "prompt number is by default"); | |
|
25 | set_prompt(index, 2); | |
|
26 | this.test.assertEquals(get_prompt(index), "In [2]:", "prompt number is 2"); | |
|
27 | set_prompt(index, 0); | |
|
28 | this.test.assertEquals(get_prompt(index), "In [0]:", "prompt number is 0"); | |
|
29 | set_prompt(index, "*"); | |
|
30 | this.test.assertEquals(get_prompt(index), "In [*]:", "prompt number is *"); | |
|
31 | set_prompt(index, undefined); | |
|
32 | this.test.assertEquals(get_prompt(index), "In [ ]:", "prompt number is "); | |
|
33 | set_prompt(index, null); | |
|
34 | this.test.assertEquals(get_prompt(index), "In [ ]:", "prompt number is "); | |
|
35 | }); | |
|
36 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now