##// END OF EJS Templates
Cherry pick of @jasongrout 's 2bc2f96....
Cherry pick of @jasongrout 's 2bc2f96. Only merged changes to notebook and kernel... (see original comment below). Separate the widget registry from the widget managers; attach widget managers to kernels. Yet to do: take care of clean-up when a kernel is deleted Conflicts: IPython/html/static/notebook/js/widgetmanager.js IPython/html/static/notebook/js/widgets/widget.js

File last commit:

r14596:5cd33034
r14622:43cee970
Show More
widgets_string.js
51 lines | 2.0 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget string class
casper.notebook_test(function () {
index = this.append_cell(
'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
'print("Success")');
this.execute_cell_then(index);
var string_index = this.append_cell(
Jonathan Frederic
Fixed *almost* all of the test-detected bugs
r14596 'string_widget = [widgets.TextBoxWidget(value = "xyz"),\n' +
' widgets.TextAreaWidget(value = "xyz"),\n' +
' widgets.HTMLWidget(value = "xyz"),\n' +
' widgets.LatexWidget(value = "$\\\\LaTeX{}$")]\n' +
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 '[display(widget) for widget in string_widget]\n'+
Jonathan Frederic
Organized tests.
r14464 'print("Success")');
this.execute_cell_then(string_index, function(index){
this.test.assert(this.get_output_cell(index).text == 'Success\n',
'Create string widget cell executed with correct output.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea .widget-hbox-single input[type=text]'),
'Textbox exists.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea .widget-hbox textarea'),
'Textarea exists.');
this.test.assert(this.cell_element_function(index,
'.widget-area .widget-subarea .widget-hbox textarea', 'val')=='xyz',
'Python set textarea value.');
this.test.assert(this.cell_element_function(index,
'.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='xyz',
'Python set textbox value.');
});
this.wait(500); // Wait for change to execute in kernel
index = this.append_cell('print(string_widget.value)');
this.execute_cell_then(index, function(index){
this.test.assert(this.cell_element_exists(string_index,
'.widget-area .widget-subarea div span.MathJax_Preview'),
'MathJax parsed the LaTeX successfully.');
});
});