##// END OF EJS Templates
fix test
fix test

File last commit:

r18910:4100b1b7
r19293:2cc95333
Show More
widget_string.js
59 lines | 2.5 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget string class
casper.notebook_test(function () {
Jonathan Frederic
Make all tests async display safe
r18910 var string_index = this.append_cell(
Jonathan Frederic
Organized tests.
r14464 'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'string_widget = [widgets.Text(value = "xyz", placeholder = "abc"),\n' +
' widgets.Textarea(value = "xyz", placeholder = "def"),\n' +
' widgets.HTML(value = "xyz"),\n' +
' widgets.Latex(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){
MinRK
first review pass on widget tests
r14797 this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
Jonathan Frederic
Organized tests.
r14464 'Create string widget cell executed with correct output.');
Jonathan Frederic
Make all tests async display safe
r18910 });
// Wait for the widget to actually display.
var textbox_selector = '.widget-area .widget-subarea .widget-hbox input[type=text]';
var textarea_selector = '.widget-area .widget-subarea .widget-hbox textarea';
var latex_selector = '.widget-area .widget-subarea div span.MathJax_Preview';
this.wait_for_element(string_index, textbox_selector);
this.wait_for_element(string_index, textarea_selector);
this.wait_for_element(string_index, latex_selector);
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Make all tests async display safe
r18910 // Continue with the tests.
this.then(function(){
this.test.assert(this.cell_element_exists(string_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(string_index,
textbox_selector),
Jonathan Frederic
Organized tests.
r14464 'Textbox exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_exists(string_index,
textarea_selector),
Jonathan Frederic
Organized tests.
r14464 'Textarea exists.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_function(string_index,
textarea_selector, 'val')=='xyz',
Jonathan Frederic
Organized tests.
r14464 'Python set textarea value.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_function(string_index,
textbox_selector, 'val')=='xyz',
Jonathan Frederic
Organized tests.
r14464 'Python set textbox value.');
this.test.assert(this.cell_element_exists(string_index,
Jonathan Frederic
Make all tests async display safe
r18910 latex_selector),
Jonathan Frederic
Organized tests.
r14464 'MathJax parsed the LaTeX successfully.');
Jessica B. Hamrick
Add javascript tests for placeholder feature
r16344
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_function(string_index,
textarea_selector, 'attr', ['placeholder'])=='def',
Jessica B. Hamrick
Add javascript tests for placeholder feature
r16344 'Python set textarea placeholder.');
Jonathan Frederic
Make all tests async display safe
r18910 this.test.assert(this.cell_element_function(string_index,
textbox_selector, 'attr', ['placeholder'])=='abc',
Jessica B. Hamrick
Add javascript tests for placeholder feature
r16344 'Python set textbox placehoder.');
Jonathan Frederic
Organized tests.
r14464 });
Jessica B. Hamrick
Add javascript tests for placeholder feature
r16344 });