From 1797243f7aa0a766e63de6f444557014e3cf5b6e Mon Sep 17 00:00:00 2001 From: Jonathan Frederic Date: Fri, 22 Aug 2014 12:20:59 -0700 Subject: [PATCH] Fix tests --- IPython/html/tests/widgets/widget.js | 4 ++-- IPython/html/tests/widgets/widget_box.js | 8 ++++---- IPython/html/tests/widgets/widget_float.js | 4 ++-- IPython/html/tests/widgets/widget_image.js | 1 - IPython/html/tests/widgets/widget_int.js | 8 ++++---- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/IPython/html/tests/widgets/widget.js b/IPython/html/tests/widgets/widget.js index 005d75e67..9364f0375 100644 --- a/IPython/html/tests/widgets/widget.js +++ b/IPython/html/tests/widgets/widget.js @@ -149,7 +149,7 @@ casper.notebook_test(function () { 'import time\n' + 'textbox = widgets.Text()\n' + 'display(textbox)\n' + - 'textbox.add_class("my-throttle-textbox", selector="input")\n' + + 'textbox._dom_classes = ["my-throttle-textbox"]\n' + 'def handle_change(name, old, new):\n' + ' display(len(new))\n' + ' time.sleep(0.5)\n' + @@ -166,7 +166,7 @@ casper.notebook_test(function () { '.my-throttle-textbox'), 'Textbox exists.'); // Send 20 characters - this.sendKeys('.my-throttle-textbox', '....................'); + this.sendKeys('.my-throttle-textbox input', '....................'); }); this.wait_for_widget(textbox); diff --git a/IPython/html/tests/widgets/widget_box.js b/IPython/html/tests/widgets/widget_box.js index c1b422a38..c92402cbf 100644 --- a/IPython/html/tests/widgets/widget_box.js +++ b/IPython/html/tests/widgets/widget_box.js @@ -11,7 +11,7 @@ casper.notebook_test(function () { 'button = widgets.Button()\n'+ 'container.children = [button]\n'+ 'display(container)\n'+ - 'container.add_class("my-test-class")\n'+ + 'container._dom_classes = ["my-test-class"]\n'+ 'print("Success")\n'); this.execute_cell_then(container_index, function(index){ @@ -28,7 +28,7 @@ casper.notebook_test(function () { this.test.assert(this.cell_element_exists(index, '.widget-area .widget-subarea .my-test-class'), - 'add_class works.'); + '_dom_classes works.'); this.test.assert(this.cell_element_exists(index, '.widget-area .widget-subarea .my-test-class button'), @@ -49,7 +49,7 @@ casper.notebook_test(function () { }); index = this.append_cell( - 'container.remove_class("my-test-class")\n'+ + 'container._dom_classes = []\n'+ 'print("Success")\n'); this.execute_cell_then(index, function(index){ @@ -58,7 +58,7 @@ casper.notebook_test(function () { this.test.assert(! this.cell_element_exists(container_index, '.widget-area .widget-subarea .my-test-class'), - 'remove_class works.'); + '_dom_classes can be used to remove a class.'); }); index = this.append_cell( diff --git a/IPython/html/tests/widgets/widget_float.js b/IPython/html/tests/widgets/widget_float.js index a2f4e748e..24294b44b 100644 --- a/IPython/html/tests/widgets/widget_float.js +++ b/IPython/html/tests/widgets/widget_float.js @@ -7,11 +7,11 @@ casper.notebook_test(function () { this.execute_cell_then(index); var float_text = {}; - float_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text'; + float_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-float-text input'; float_text.index = this.append_cell( 'float_widget = widgets.FloatText()\n' + 'display(float_widget)\n' + - 'float_widget.add_class("my-second-float-text", selector="input")\n' + + 'float_widget._dom_classes = ["my-second-float-text"]\n' + 'print(float_widget.model_id)\n'); this.execute_cell_then(float_text.index, function(index){ float_text.model_id = this.get_output_cell(index).text.trim(); diff --git a/IPython/html/tests/widgets/widget_image.js b/IPython/html/tests/widgets/widget_image.js index c858c68a2..2cce2d0a9 100644 --- a/IPython/html/tests/widgets/widget_image.js +++ b/IPython/html/tests/widgets/widget_image.js @@ -27,7 +27,6 @@ casper.notebook_test(function () { // window. If we don't do this, the captured image will be black. 'image.set_css({"background": "blue", "z-index": "9999", "position": "fixed", "top": "0px", "left": "0px"})\n' + 'display(image)\n' + - 'image.add_class("my-test-image")\n' + 'print("Success")\n'); this.execute_cell_then(image_index, function(index){ diff --git a/IPython/html/tests/widgets/widget_int.js b/IPython/html/tests/widgets/widget_int.js index a9bc43d90..a3a02639a 100644 --- a/IPython/html/tests/widgets/widget_int.js +++ b/IPython/html/tests/widgets/widget_int.js @@ -7,11 +7,11 @@ casper.notebook_test(function () { this.execute_cell_then(index); var int_text = {}; - int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text'; + int_text.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-int-text input'; int_text.index = this.append_cell( 'int_widget = widgets.IntText()\n' + 'display(int_widget)\n' + - 'int_widget.add_class("my-second-int-text", selector="input")\n' + + 'int_widget._dom_classes = ["my-second-int-text"]\n' + '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(); @@ -64,12 +64,12 @@ casper.notebook_test(function () { var slider_query = '.widget-area .widget-subarea .widget-hbox-single .slider'; var int_text2 = {}; - int_text2.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text'; + int_text2.query = '.widget-area .widget-subarea .widget-hbox-single .my-second-num-test-text input'; int_text2.index = this.append_cell( 'intrange = [widgets.BoundedIntTextWidget(),\n' + ' widgets.IntSliderWidget()]\n' + '[display(intrange[i]) for i in range(2)]\n' + - 'intrange[0].add_class("my-second-num-test-text", selector="input")\n' + + 'intrange[0]._dom_classes = ["my-second-num-test-text"]\n' + '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();