Show More
@@ -42,4 +42,53 b' casper.notebook_test(function () {' | |||||
42 | var slider_id = this.evaluate(function() { return window.slider_id; }); |
|
42 | var slider_id = this.evaluate(function() { return window.slider_id; }); | |
43 | this.test.assertEquals(output, slider_id, "Widget created from the front-end."); |
|
43 | this.test.assertEquals(output, slider_id, "Widget created from the front-end."); | |
44 | }); |
|
44 | }); | |
|
45 | ||||
|
46 | // Widget persistence tests. | |||
|
47 | index = this.append_cell( | |||
|
48 | 'from IPython.html.widgets import HTML\n' + | |||
|
49 | 'from IPython.display import display\n' + | |||
|
50 | 'display(HTML(value="<div id=\'hello\'></div>"))'); | |||
|
51 | this.execute_cell_then(index, function() {}); | |||
|
52 | ||||
|
53 | index = this.append_cell( | |||
|
54 | 'display(HTML(value="<div id=\'world\'></div>"))'); | |||
|
55 | this.execute_cell_then(index, function() {}); | |||
|
56 | ||||
|
57 | var that = this; | |||
|
58 | this.then(function() { | |||
|
59 | // Wait for the widgets to be shown. | |||
|
60 | that.waitForSelector('#hello', function() { | |||
|
61 | that.waitForSelector('#world', function() { | |||
|
62 | that.test.assertExists('#hello', 'Hello HTML widget constructed.'); | |||
|
63 | that.test.assertExists('#world', 'World HTML widget constructed.'); | |||
|
64 | ||||
|
65 | // Save the notebook. | |||
|
66 | that.evaluate(function() { | |||
|
67 | IPython.notebook.save_notebook(false).then(function() { | |||
|
68 | window.was_saved = true; | |||
|
69 | }); | |||
|
70 | }); | |||
|
71 | that.waitFor(function check() { | |||
|
72 | return that.evaluate(function() { | |||
|
73 | return window.was_saved; | |||
|
74 | }); | |||
|
75 | }, function then() { | |||
|
76 | ||||
|
77 | // Reload the page | |||
|
78 | that.reload(function() { | |||
|
79 | ||||
|
80 | // Wait for the elements to show up again. | |||
|
81 | that.waitForSelector('#hello', function() { | |||
|
82 | that.waitForSelector('#world', function() { | |||
|
83 | that.test.assertExists('#hello', 'Hello HTML widget persisted.'); | |||
|
84 | that.test.assertExists('#world', 'World HTML widget persisted.'); | |||
|
85 | }); | |||
|
86 | }); | |||
|
87 | }); | |||
|
88 | }); | |||
|
89 | }); | |||
|
90 | }); | |||
|
91 | }); | |||
|
92 | ||||
|
93 | ||||
45 | }); |
|
94 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now