##// END OF EJS Templates
Pull docs on defining magics out to customisation section
Pull docs on defining magics out to customisation section

File last commit:

r17598:99ab024b
r17789:3164f840
Show More
widget_int.js
156 lines | 6.1 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget int 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
Fix js-tests for new default selector logic.
r17472 var int_text = {};
Jonathan Frederic
Remove sleep from the following,...
r14970 int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text';
int_text.index = this.append_cell(
Jonathan Frederic
Renamed *Widget to *,...
r17598 'int_widget = widgets.IntText()\n' +
Jonathan Frederic
Organized tests.
r14464 'display(int_widget)\n' +
Jonathan Frederic
Fix js-tests for new default selector logic.
r17472 'int_widget.add_class("my-second-int-text", selector="input")\n' +
Jonathan Frederic
Remove sleep from the following,...
r14970 'print(int_widget.model_id)\n');
this.execute_cell_then(int_text.index, function(index){
int_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, int_text.query),
Jonathan Frederic
Organized tests.
r14464 'Widget int textbox exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(int_text.index, int_text.query, 'val', ['']);
this.sendKeys(int_text.query, '1.05');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text);
Jonathan Frederic
Organized tests.
r14464
index = this.append_cell('print(int_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\n',
Jonathan Frederic
Organized tests.
r14464 'Int textbox value set.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(int_text.index, int_text.query, 'val', ['']);
this.sendKeys(int_text.query, '123456789');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text);
Jonathan Frederic
Organized tests.
r14464
index = this.append_cell('print(int_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\n',
Jonathan Frederic
Organized tests.
r14464 'Long int textbox value set (probably triggers throttling).');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.cell_element_function(int_text.index, int_text.query, 'val', ['']);
this.sendKeys(int_text.query, '12hello');
Jonathan Frederic
Organized tests.
r14464 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text);
Jonathan Frederic
Organized tests.
r14464
index = this.append_cell('print(int_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\n',
Jonathan Frederic
Organized tests.
r14464 'Invald int textbox value caught and filtered.');
});
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
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 slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider';
var int_text2 = {};
int_text2.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text';
int_text2.index = this.append_cell(
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'intrange = [widgets.BoundedIntTextWidget(),\n' +
' widgets.IntSliderWidget()]\n' +
'[display(intrange[i]) for i in range(2)]\n' +
Jonathan Frederic
Fix js-tests for new default selector logic.
r17472 'intrange[0].add_class("my-second-num-test-text", selector="input")\n' +
Jonathan Frederic
Remove sleep from the following,...
r14970 'print(intrange[0].model_id)\n');
this.execute_cell_then(int_text2.index, function(index){
int_text2.model_id = this.get_output_cell(index).text.trim();
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
this.test.assert(this.cell_element_exists(index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
this.test.assert(this.cell_element_exists(index, slider_query),
'Widget slider exists.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_exists(index, int_text2.query),
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Widget int textbox exists.');
});
index = this.append_cell(
'for widget in intrange:\n' +
' widget.max = 50\n' +
' widget.min = -50\n' +
' widget.value = 25\n' +
'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 'Int range properties cell executed with correct output.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_exists(int_text2.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(int_text2.index, slider_query,
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'slider', ['value']) == 25,
'Slider set to Python value.');
Jonathan Frederic
Remove sleep from the following,...
r14970 this.test.assert(this.cell_element_function(int_text2.index, int_text2.query,
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'val') == 25, 'Int textbox set to Python value.');
// Clear the int textbox value and then set it to 1 by emulating
// keyboard presses.
Jonathan Frederic
Make int widget tests play nicely with slimer
r16832 this.evaluate(function(q){
var textbox = IPython.notebook.element.find(q);
textbox.val('1');
textbox.trigger('keyup');
}, {q: int_text2.query});
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text2);
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
index = this.append_cell('print(intrange[0].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\n',
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Int textbox set int range value');
// Clear the int textbox value and then set it to 120 by emulating
// keyboard presses.
Jonathan Frederic
Make int widget tests play nicely with slimer
r16832 this.evaluate(function(q){
var textbox = IPython.notebook.element.find(q);
textbox.val('120');
textbox.trigger('keyup');
}, {q: int_text2.query});
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text2);
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
index = this.append_cell('print(intrange[0].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, '50\n',
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Int textbox value bound');
// Clear the int textbox value and then set it to 'hello world' by
// emulating keyboard presses. 'hello world' should get filtered...
Jonathan Frederic
Make int widget tests play nicely with slimer
r16832 this.evaluate(function(q){
var textbox = IPython.notebook.element.find(q);
textbox.val('hello world');
textbox.trigger('keyup');
}, {q: int_text2.query});
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 });
Jonathan Frederic
Remove sleep from the following,...
r14970 this.wait_for_widget(int_text2);
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
index = this.append_cell('print(intrange[0].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, '50\n',
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 'Invalid int textbox characters ignored');
});
Jonathan Frederic
Organized tests.
r14464 });