##// END OF EJS Templates
Work around a bug in setting and getting the mtime in python 2...
Work around a bug in setting and getting the mtime in python 2 See http://bugs.python.org/issue12904. Basically, we can get the mtime in nanosecond precision, but only set it in microsecond precision. This means that the shutil.copy2 will not set the destination's mtime to exactly the same mtime as our source. The end result is that we can *always* end up copying the extension because the source always appears newer. We add a microsecond of fudge time when checking to see if the source is newer than the destination to get around this. This bug is fixed in Python 3.3+, I believe.

File last commit:

r18910:4100b1b7
r20080:52d92404
Show More
widget_string.js
59 lines | 2.5 KiB | application/javascript | JavascriptLexer
// Test widget string class
casper.notebook_test(function () {
var string_index = this.append_cell(
'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
'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' +
'[display(widget) for widget in string_widget]\n'+
'print("Success")');
this.execute_cell_then(string_index, function(index){
this.test.assertEquals(this.get_output_cell(index).text, 'Success\n',
'Create string widget cell executed with correct output.');
});
// 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);
// Continue with the tests.
this.then(function(){
this.test.assert(this.cell_element_exists(string_index,
'.widget-area .widget-subarea'),
'Widget subarea exists.');
this.test.assert(this.cell_element_exists(string_index,
textbox_selector),
'Textbox exists.');
this.test.assert(this.cell_element_exists(string_index,
textarea_selector),
'Textarea exists.');
this.test.assert(this.cell_element_function(string_index,
textarea_selector, 'val')=='xyz',
'Python set textarea value.');
this.test.assert(this.cell_element_function(string_index,
textbox_selector, 'val')=='xyz',
'Python set textbox value.');
this.test.assert(this.cell_element_exists(string_index,
latex_selector),
'MathJax parsed the LaTeX successfully.');
this.test.assert(this.cell_element_function(string_index,
textarea_selector, 'attr', ['placeholder'])=='def',
'Python set textarea placeholder.');
this.test.assert(this.cell_element_function(string_index,
textbox_selector, 'attr', ['placeholder'])=='abc',
'Python set textbox placehoder.');
});
});