Show More
@@ -2,20 +2,35 b'' | |||||
2 | // Test that a Markdown cell is rendered to HTML. |
|
2 | // Test that a Markdown cell is rendered to HTML. | |
3 | // |
|
3 | // | |
4 | casper.notebookTest(function () { |
|
4 | casper.notebookTest(function () { | |
5 | var output = this.evaluate(function() { |
|
5 | // Test JavaScript models. | |
6 | // Does it make more sense to test the UI or the JS API here? |
|
6 | var output = this.evaluate(function () { | |
7 | // |
|
|||
8 | // $('#cell_type').val('markdown'); |
|
|||
9 | // $('#cell_type').change(); |
|
|||
10 | // $('#run_b').click(); |
|
|||
11 | // |
|
|||
12 | // $('#to_markdown').click(); // fails via jQuery UI menubar |
|
|||
13 | // $('#run_cell').click(); // fails via jQuery UI menubar |
|
|||
14 | IPython.notebook.to_markdown(); |
|
7 | IPython.notebook.to_markdown(); | |
15 | var cell = IPython.notebook.get_selected_cell(); |
|
8 | var cell = IPython.notebook.get_selected_cell(); | |
16 | cell.set_text('# Foo'); |
|
9 | cell.set_text('# Foo'); | |
17 | cell.render(); |
|
10 | cell.render(); | |
18 | return cell.get_rendered(); |
|
11 | return cell.get_rendered(); | |
19 | }); |
|
12 | }); | |
20 |
this.test.assertEquals(output, '<h1>Foo</h1>', 'Markdown |
|
13 | this.test.assertEquals(output, '<h1>Foo</h1>', 'Markdown JS API works.'); | |
|
14 | ||||
|
15 | // Test menubar entries. | |||
|
16 | output = this.evaluate(function () { | |||
|
17 | $('#to_code').mouseenter().click(); | |||
|
18 | $('#to_markdown').mouseenter().click(); | |||
|
19 | var cell = IPython.notebook.get_selected_cell(); | |||
|
20 | cell.set_text('# Foo'); | |||
|
21 | $('#run_cell').mouseenter().click(); | |||
|
22 | return cell.get_rendered(); | |||
|
23 | }); | |||
|
24 | this.test.assertEquals(output, '<h1>Foo</h1>', 'Markdown menubar items work.'); | |||
|
25 | ||||
|
26 | // Test toolbar buttons. | |||
|
27 | output = this.evaluate(function () { | |||
|
28 | $('#cell_type').val('code').change(); | |||
|
29 | $('#cell_type').val('markdown').change(); | |||
|
30 | var cell = IPython.notebook.get_selected_cell(); | |||
|
31 | cell.set_text('# Foo'); | |||
|
32 | $('#run_b').click(); | |||
|
33 | return cell.get_rendered(); | |||
|
34 | }); | |||
|
35 | this.test.assertEquals(output, '<h1>Foo</h1>', 'Markdown toolbar items work.'); | |||
21 | }); |
|
36 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now