Show More
@@ -163,6 +163,7 define([ | |||||
163 | * */ |
|
163 | * */ | |
164 | TextCell.prototype.set_text = function(text) { |
|
164 | TextCell.prototype.set_text = function(text) { | |
165 | this.code_mirror.setValue(text); |
|
165 | this.code_mirror.setValue(text); | |
|
166 | this.unrender(); | |||
166 | this.code_mirror.refresh(); |
|
167 | this.code_mirror.refresh(); | |
167 | }; |
|
168 | }; | |
168 |
|
169 |
@@ -17,20 +17,31 casper.notebook_test(function () { | |||||
17 | $('#to_code').mouseenter().click(); |
|
17 | $('#to_code').mouseenter().click(); | |
18 | $('#to_markdown').mouseenter().click(); |
|
18 | $('#to_markdown').mouseenter().click(); | |
19 | var cell = IPython.notebook.get_selected_cell(); |
|
19 | var cell = IPython.notebook.get_selected_cell(); | |
20 |
cell.set_text('# |
|
20 | cell.set_text('# Bar'); | |
21 | $('#run_cell').mouseenter().click(); |
|
21 | $('#run_cell').mouseenter().click(); | |
22 | return cell.get_rendered(); |
|
22 | return cell.get_rendered(); | |
23 | }); |
|
23 | }); | |
24 |
this.test.assertEquals(output.trim(), '<h1 id=\" |
|
24 | this.test.assertEquals(output.trim(), '<h1 id=\"bar\">Bar</h1>', 'Markdown menubar items work.'); | |
25 |
|
25 | |||
26 | // Test toolbar buttons. |
|
26 | // Test toolbar buttons. | |
27 | output = this.evaluate(function () { |
|
27 | output = this.evaluate(function () { | |
28 | $('#cell_type').val('code').change(); |
|
28 | $('#cell_type').val('code').change(); | |
29 | $('#cell_type').val('markdown').change(); |
|
29 | $('#cell_type').val('markdown').change(); | |
30 | var cell = IPython.notebook.get_selected_cell(); |
|
30 | var cell = IPython.notebook.get_selected_cell(); | |
31 |
cell.set_text('# |
|
31 | cell.set_text('# Baz'); | |
32 | $('#run_b').click(); |
|
32 | $('#run_b').click(); | |
33 | return cell.get_rendered(); |
|
33 | return cell.get_rendered(); | |
34 | }); |
|
34 | }); | |
35 |
this.test.assertEquals(output.trim(), '<h1 id=\" |
|
35 | this.test.assertEquals(output.trim(), '<h1 id=\"baz\">Baz</h1>', 'Markdown toolbar items work.'); | |
|
36 | ||||
|
37 | // Test JavaScript models. | |||
|
38 | var output = this.evaluate(function () { | |||
|
39 | ||||
|
40 | var cell = IPython.notebook.insert_cell_at_index('markdown', 0); | |||
|
41 | cell.set_text('# Qux'); | |||
|
42 | cell.render(); | |||
|
43 | return cell.get_rendered(); | |||
|
44 | }); | |||
|
45 | this.test.assertEquals(output.trim(), '<h1 id=\"qux\">Qux</h1>', 'Markdown JS API works.'); | |||
|
46 | ||||
36 | }); |
|
47 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now