Show More
@@ -820,4 +820,66 b' casper.notebook_test(function () {' | |||
|
820 | 820 | this.test.assert(verify_selection(this, 4), 'Item added to selection widget.'); |
|
821 | 821 | }); |
|
822 | 822 | |
|
823 | // Test string widget ////////////////////////////////////////////////////// | |
|
824 | var string_index = this.append_cell( | |
|
825 | 'string_widget = widgets.StringWidget()\n' + | |
|
826 | 'display(string_widget)\n'+ | |
|
827 | 'display(string_widget, view_name="TextAreaView")\n' + | |
|
828 | 'display(string_widget, view_name="HTMLView")\n' + | |
|
829 | 'display(string_widget, view_name="LatexView")\n' + | |
|
830 | 'string_widget.value = "xyz"\n' + | |
|
831 | 'print("Success")'); | |
|
832 | this.execute_cell_then(string_index, function(index){ | |
|
833 | ||
|
834 | this.test.assert(this.get_output_cell(index).text == 'Success\n', | |
|
835 | 'Create string widget cell executed with correct output.'); | |
|
836 | ||
|
837 | this.test.assert(this.cell_element_exists(index, | |
|
838 | '.widget-area .widget-subarea'), | |
|
839 | 'Widget subarea exists.'); | |
|
840 | ||
|
841 | this.test.assert(this.cell_element_exists(index, | |
|
842 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]'), | |
|
843 | 'Textbox exists.'); | |
|
844 | ||
|
845 | this.test.assert(this.cell_element_exists(index, | |
|
846 | '.widget-area .widget-subarea .widget-hbox textarea'), | |
|
847 | 'Textarea exists.'); | |
|
848 | ||
|
849 | this.test.assert(this.cell_element_function(index, | |
|
850 | '.widget-area .widget-subarea .widget-hbox textarea', 'val')=='xyz', | |
|
851 | 'Python set textarea value.'); | |
|
852 | ||
|
853 | this.test.assert(this.cell_element_function(index, | |
|
854 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='xyz', | |
|
855 | 'Python set textbox value.'); | |
|
856 | ||
|
857 | this.cell_element_function(index, | |
|
858 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val', ['']) | |
|
859 | this.sendKeys('.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'abc'); | |
|
860 | ||
|
861 | this.test.assert(this.cell_element_function(index, | |
|
862 | '.widget-area .widget-subarea .widget-hbox textarea', 'val')=='abc', | |
|
863 | 'Textarea updated to textbox contents.'); | |
|
864 | ||
|
865 | this.cell_element_function(index, | |
|
866 | '.widget-area .widget-subarea .widget-hbox textarea', 'val', ['']); | |
|
867 | this.sendKeys('.widget-area .widget-subarea .widget-hbox textarea', '$\\LaTeX{}$'); | |
|
868 | ||
|
869 | this.test.assert(this.cell_element_function(index, | |
|
870 | '.widget-area .widget-subarea .widget-hbox-single input[type=text]', 'val')=='$\\LaTeX{}$', | |
|
871 | 'Textbox updated to textarea contents.'); | |
|
872 | }); | |
|
873 | ||
|
874 | this.wait(500); // Wait for change to execute in kernel | |
|
875 | ||
|
876 | index = this.append_cell('print(string_widget.value)'); | |
|
877 | this.execute_cell_then(index, function(index){ | |
|
878 | this.test.assert(this.get_output_cell(index).text == '$\\LaTeX{}$\n', | |
|
879 | 'Python updated with correct string widget value.'); | |
|
880 | ||
|
881 | this.test.assert(this.cell_element_exists(string_index, | |
|
882 | '.widget-area .widget-subarea div span.MathJax_Preview'), | |
|
883 | 'MathJax parsed the LaTeX successfully.'); | |
|
884 | }); | |
|
823 | 885 | }); |
General Comments 0
You need to be logged in to leave comments.
Login now