##// END OF EJS Templates
Merge branch 'master' of github.com:ipython/ipython
Merge branch 'master' of github.com:ipython/ipython

File last commit:

r15201:029ac024
r15912:ebb27d01 merge
Show More
widget_float.js
99 lines | 4.0 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget float 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);
Jonathan Frederic
Remove sleep from the following,...
r14970 var float_text = {};
float_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text';
float_text.index = this.append_cell(
Jonathan Frederic
Fixed *almost* all of the test-detected bugs
r14596 'float_widget = widgets.FloatTextWidget()\n' +
Jonathan Frederic
Organized tests.
r14464 'display(float_widget)\n' +
'float_widget.add_class("my-second-float-text")\n' +
Jonathan Frederic
Remove sleep from the following,...
r14970 'print(float_widget.model_id)\n');
this.execute_cell_then(float_text.index, function(index){
float_text.model_id = this.get_output_cell(index).text.trim();
Jonathan Frederic
Organized tests.
r14464 this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_exists(index, float_text.query),
Jonathan Frederic
Organized tests.
r14464 'Widget float textbox exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(float_text.index, float_text.query, 'val', ['']);
this.sendKeys(float_text.query, '1.05');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(float_text);
Jonathan Frederic
Organized tests.
r14464
index = this.append_cell('print(float_widget.value)\n');
this.execute_cell_then(index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, '1.05\n',
Jonathan Frederic
Organized tests.
r14464 'Float textbox value set.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(float_text.index, float_text.query, 'val', ['']);
this.sendKeys(float_text.query, '123456789.0');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(float_text);
Jonathan Frederic
Organized tests.
r14464 index = this.append_cell('print(float_widget.value)\n');
this.execute_cell_then(index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, '123456789.0\n',
Jonathan Frederic
Organized tests.
r14464 'Long float textbox value set (probably triggers throttling).');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(float_text.index, float_text.query, 'val', ['']);
this.sendKeys(float_text.query, '12hello');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(float_text);
Jonathan Frederic
Organized tests.
r14464
index = this.append_cell('print(float_widget.value)\n');
this.execute_cell_then(index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, '12.0\n',
Jonathan Frederic
Organized tests.
r14464 'Invald float textbox value caught and filtered.');
});
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
var float_text_query = '.widget-area .widget-subarea .widget-hbox-single .widget-numeric-text';
Jonathan Frederic
Remove sleep from the following,...
r14970 var slider = {};
slider.query = '.widget-area .widget-subarea .widget-hbox-single .slider';
slider.index = this.append_cell(
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'floatrange = [widgets.BoundedFloatTextWidget(), \n' +
' widgets.FloatSliderWidget()]\n' +
'[display(floatrange[i]) for i in range(2)]\n' +
'print("Success")\n');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.execute_cell_then(slider.index, function(index){
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Create float range cell executed with correct output.');
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_exists(index, slider.query),
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Widget slider exists.');
this.test.assert(this.cell_element_exists(index, float_text_query),
'Widget float textbox exists.');
});
index = this.append_cell(
'for widget in floatrange:\n' +
' widget.max = 50.0\n' +
' widget.min = -50.0\n' +
Jonathan Frederic
Removed float widget bound tests,...
r14690 ' widget.value = 25.0\n' +
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'print("Success")\n');
this.execute_cell_then(index, function(index){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Float range properties cell executed with correct output.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_exists(slider.index, slider.query),
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Widget slider exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_function(slider.index, slider.query,
Jonathan Frederic
Removed float widget bound tests,...
r14690 'slider', ['value']) == 25.0,
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Slider set to Python value.');
});
Jonathan Frederic
Organized tests.
r14464 });