##// END OF EJS Templates
checking in css
checking in css

File last commit:

r18910:4100b1b7
r19291:84667822
Show More
widget_int.js
176 lines | 6.7 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget int class
casper.notebook_test(function () {
Jonathan Frederic
Fix js-tests for new default selector logic.
r17472 var int_text = {};
Jonathan Frederic
Fixed rebase bugs and other bugs.
r17731 int_text.query = '.widget-area .widget-subarea .my-second-int-text input';
Jonathan Frederic
Remove sleep from the following,...
r14970 int_text.index = this.append_cell(
Jonathan Frederic
Make all tests async display safe
r18910 'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'int_widget = widgets.IntText()\n' +
Jonathan Frederic
Organized tests.
r14464 'display(int_widget)\n' +
Jonathan Frederic
Fix tests
r17721 'int_widget._dom_classes = ["my-second-int-text"]\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
Make all tests async display safe
r18910 });
// Wait for the widget to actually display.
this.wait_for_element(int_text.index, int_text.query);
// Continue with the tests.
this.then(function() {
this.test.assert(this.cell_element_exists(int_text.index,
Jonathan Frederic
Organized tests.
r14464 '.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_exists(int_text.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
Jonathan Frederic
Fixed rebase bugs and other bugs.
r17731 var slider_query = '.widget-area .widget-subarea .slider';
Jonathan Frederic
Remove sleep from the following,...
r14970 var int_text2 = {};
Jonathan Frederic
Fixed rebase bugs and other bugs.
r17731 int_text2.query = '.widget-area .widget-subarea .my-second-num-test-text input';
Jonathan Frederic
Remove sleep from the following,...
r14970 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 tests
r17721 'intrange[0]._dom_classes = ["my-second-num-test-text"]\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
Make all tests async display safe
r18910 });
// Wait for the widgets to actually display.
this.wait_for_element(int_text2.index, int_text2.query);
this.wait_for_element(int_text2.index, slider_query);
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674
Jonathan Frederic
Make all tests async display safe
r18910 // Continue with the tests.
this.then(function(){
this.test.assert(this.cell_element_exists(int_text2.index,
Jonathan Frederic
Made tests reflect changes to widget naming scheme.
r14674 '.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
Make all tests async display safe
r18910 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
Make all tests async display safe
r18910 this.test.assert(this.cell_element_exists(int_text2.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
Added test
r17938
index = this.append_cell(
'a = widgets.IntSlider()\n' +
'display(a)\n' +
'a.max = -1\n' +
'print("Success")\n');
this.execute_cell_then(index, function(index){
Jonathan Frederic
Fix infinite loop typo
r17967 this.test.assertEquals(0, 0, 'Invalid int range max bound does not cause crash.');
Jonathan Frederic
Fix conflict with d1305d7510cc3
r18189 }, true);
Jonathan Frederic
Added test
r17938
index = this.append_cell(
'a = widgets.IntSlider()\n' +
'display(a)\n' +
'a.min = 101\n' +
'print("Success")\n');
this.execute_cell_then(index, function(index){
Jonathan Frederic
Fix infinite loop typo
r17967 this.test.assertEquals(0, 0, 'Invalid int range min bound does not cause crash.');
Jonathan Frederic
Fix conflict with d1305d7510cc3
r18189 }, true);
Jonathan Frederic
Organized tests.
r14464 });