##// END OF EJS Templates
Backport PR #8000: Fix rename issues in dashboard...
Backport PR #8000: Fix rename issues in dashboard - Do not display the full path of the selected item in the text box (**warning** : this removes the possibility of moving a file/folder using the rename dialog. Maybe someone finds this helpful) - Adapt dialog for files and notebook. - Do not allow renaming a running notebook (currently, renaming a running notebook would result in duplication instead of renaming after the open notebook saves/autosaves using the old name)

File last commit:

r20397:ae55f08d
r20876:86af759b
Show More
widget_bool.js
92 lines | 3.8 KiB | application/javascript | JavascriptLexer
Jonathan Frederic
Organized tests.
r14464 // Test widget bool class
casper.notebook_test(function () {
Matthias Bussonnier
Some code cleanup in javascript and python...
r19739 "use strict";
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Make all tests async display safe
r18910 // Create a checkbox and togglebutton.
Jonathan Frederic
Organized tests.
r14464 var bool_index = this.append_cell(
Jonathan Frederic
bool_test passing with slimerjs
r18909 'from IPython.html import widgets\n' +
'from IPython.display import display, clear_output\n' +
Jonathan Frederic
Renamed *Widget to *,...
r17598 'bool_widgets = [widgets.Checkbox(description="Title", value=True),\n' +
' widgets.ToggleButton(description="Title", value=True)]\n' +
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 'display(bool_widgets[0])\n' +
'display(bool_widgets[1])\n' +
Jonathan Frederic
Organized tests.
r14464 'print("Success")');
this.execute_cell_then(bool_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 bool widget cell executed with correct output.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 });
Jonathan Frederic
Make all tests async display safe
r18910 // Wait for the widgets to actually display.
var widget_checkbox_selector = '.widget-area .widget-subarea .widget-hbox input';
var widget_togglebutton_selector = '.widget-area .widget-subarea button';
this.wait_for_element(bool_index, widget_checkbox_selector);
this.wait_for_element(bool_index, widget_togglebutton_selector);
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
Make all tests async display safe
r18910 // Continue the tests.
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.then(function() {
this.test.assert(this.cell_element_exists(bool_index,
Jonathan Frederic
Organized tests.
r14464 '.widget-area .widget-subarea'),
'Widget subarea exists.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_exists(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_checkbox_selector),
Jonathan Frederic
Organized tests.
r14464 'Checkbox exists.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_checkbox_selector, 'prop', ['checked']),
Jonathan Frederic
Organized tests.
r14464 'Checkbox is checked.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_exists(bool_index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox .widget-label'),
Jonathan Frederic
Organized tests.
r14464 'Checkbox label exists.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Cleaned up hbox and vbox widget div styles,...
r17929 '.widget-area .widget-subarea .widget-hbox .widget-label', 'html')=="Title",
Jonathan Frederic
Organized tests.
r14464 'Checkbox labeled correctly.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_exists(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_togglebutton_selector),
Jonathan Frederic
Organized tests.
r14464 'Toggle button exists.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_function(bool_index,
Sylvain Corlay
font awesome icon
r20397 widget_togglebutton_selector, 'html')=='<i class="fa"></i>Title',
Jonathan Frederic
Organized tests.
r14464 'Toggle button labeled correctly.');
Jonathan Frederic
bool_test passing with slimerjs
r18909 this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_togglebutton_selector, 'hasClass', ['active']),
Jonathan Frederic
Organized tests.
r14464 'Toggle button is toggled.');
});
Jonathan Frederic
Make all tests async display safe
r18910 // Try changing the state of the widgets programatically.
Matthias Bussonnier
Some code cleanup in javascript and python...
r19739 var index = this.append_cell(
Jonathan Frederic
Many checks off the todo list, test fixes
r14583 'bool_widgets[0].value = False\n' +
Jonathan Frederic
More fixes
r14595 'bool_widgets[1].value = False\n' +
Jonathan Frederic
Organized tests.
r14464 'print("Success")');
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
Organized tests.
r14464 'Change bool widget value cell executed with correct output.');
this.test.assert(! this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_checkbox_selector, 'prop', ['checked']),
Jonathan Frederic
Organized tests.
r14464 'Checkbox is not checked. (1)');
this.test.assert(! this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_togglebutton_selector, 'hasClass', ['active']),
Jonathan Frederic
Organized tests.
r14464 'Toggle button is not toggled. (1)');
// Try toggling the bool by clicking on the checkbox.
Jonathan Frederic
Make all tests async display safe
r18910 this.cell_element_function(bool_index, widget_checkbox_selector, 'click');
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
More fixes
r14595 this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_checkbox_selector, 'prop', ['checked']),
Jonathan Frederic
More fixes
r14595 'Checkbox is checked. (2)');
Jonathan Frederic
Organized tests.
r14464
Jonathan Frederic
More fixes
r14595 // Try toggling the bool by clicking on the toggle button.
Jonathan Frederic
Make all tests async display safe
r18910 this.cell_element_function(bool_index, widget_togglebutton_selector, 'click');
Jonathan Frederic
More fixes
r14595
this.test.assert(this.cell_element_function(bool_index,
Jonathan Frederic
Make all tests async display safe
r18910 widget_togglebutton_selector, 'hasClass', ['active']),
Jonathan Frederic
More fixes
r14595 'Toggle button is toggled. (3)');
Jonathan Frederic
Organized tests.
r14464
});
Matthias Bussonnier
Some code cleanup in javascript and python...
r19739 });