From 919a618f4b60f0cb85f10b7a21921ce982a95730 Mon Sep 17 00:00:00 2001 From: Florian Scherf Date: Thu, 13 Jul 2023 12:54:45 +0200 Subject: [PATCH 1/2] logging: remove obsolete information when logging ClientError exceptions Previously, a raised `lona.errors.ClientError` was logged two times. Once by the view runtime, that received the error, and a second time by the general logging setup of Lona. The first log entry contained the JavaScript traceback, raised by the browser, the second log entry contained the full Python traceback from the server side. LonaWorker_0 ERROR 12:39:31.344648 lona.view_runtime client error raised: node with id 39 is already cached LonaRuntimeWorker_0 ERROR 12:39:31.345355 lona.view_runtime Exception raised while running Traceback (most recent call last): File "/home/fscherf/devel/lona/lona/view_runtime.py", line 348, in start return_value=self.view.handle_request(self.request), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/devel/lona/test_project/views/view_types/interactive_view.py", line 56, in handle_request self.sleep(float(interval.value)) File "/home/fscherf/devel/lona/lona/view.py", line 344, in sleep return self._await_sync(asyncio.sleep(delay, result)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/devel/lona/lona/view.py", line 109, in _await_sync ).result() ^^^^^^^^ File "/home/fscherf/.pyenv/versions/3.11.4/lib/python3.11/concurrent/futures/_base.py", line 456, in result return self.__get_result() ^^^^^^^^^^^^^^^^^^^ File "/home/fscherf/.pyenv/versions/3.11.4/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result raise self._exception File "/home/fscherf/devel/lona/lona/view.py", line 104, in await_awaitable raise cast(StopReason, self._view_runtime.stop_reason) The second log entry does not contain any meaningful information, and the Python traceback only contains Lona framework code, never application code. Thus it only made these errors harder to read. This patch adds a new rule to `lona.logging.LogFilter` to filter out log entries containing a `lona.errors.ClientError` traceback. Signed-off-by: Florian Scherf --- lona/logging.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lona/logging.py b/lona/logging.py index bf353bc4..4aaa864f 100644 --- a/lona/logging.py +++ b/lona/logging.py @@ -10,6 +10,7 @@ terminal_supports_colors, colors_are_enabled, ) +from lona.errors import ClientError try: # syslog is only on unix based systems available @@ -62,10 +63,11 @@ def exclude(self, logger_name): self.excluded.append(logger_name) def filter(self, record): - # filter exceptions that lona.command_line.run_server.run_server - # handles it self if record.exc_info: + # filter exceptions that lona.command_line.run_server.run_server + # handles it self + # OSErrors if (isinstance(record.exc_info[1], OSError) and record.exc_info[1].errno in (13, 98)): @@ -78,6 +80,11 @@ def filter(self, record): return False + # filter exceptions that Lona logs it-self to avoid + # duplicate logs + if isinstance(record.exc_info[1], ClientError): + return False + if record.name == 'lona': # The lona root logger is used by the command line tools # to report errors, for example when startup is not possible due From 3cd59e667ce1e52960b54517f9330e0b2bb6d631 Mon Sep 17 00:00:00 2001 From: Florian Scherf Date: Thu, 13 Jul 2023 13:32:01 +0200 Subject: [PATCH 2/2] client2: rendering: fix crash when moving a node Previously, client2 crashed when an already rendered node was moved by appending or inserting it twice within the same HTML tree. moving_node = Div('node 3') html = HTML( Div( 'node 1', moving_node, ), Div('node 2'), ) self.show(html) html[1].append(moving_node) self.show(html) # resulted in: ERROR lona.view_runtime client error raised: node with id 952 is already cached When a node is moved by adding it twice to the same node tree, internally, it gets destroyed at the old location, and a new node, with the old id, gets rendered in the new location. Previously, the rendering engines node cache got not cleaned after the first step, so all child nodes of `moving_node`, which is a text node with the text "node 3" in this case, remained cached. When the rendering engine attempted to render a new div, identical to the former removed one, the cache function would raise an error because the old text node still was cached. This patch adds a cache cleaning call to the rendering engines `_remove_node` method and adds a rendering test for moving nodes. Signed-off-by: Florian Scherf --- .../client2/_lona/client2/rendering-engine.js | 1 + test_project/views/frontend/rendering.py | 306 ++++++++++-------- tests/test_0304_rendering.py | 44 +-- 3 files changed, 186 insertions(+), 165 deletions(-) diff --git a/lona/client2/_lona/client2/rendering-engine.js b/lona/client2/_lona/client2/rendering-engine.js index 26f32d86..170883d3 100644 --- a/lona/client2/_lona/client2/rendering-engine.js +++ b/lona/client2/_lona/client2/rendering-engine.js @@ -104,6 +104,7 @@ export class LonaRenderingEngine { node.remove(); this._remove_widget_if_present(node_id); + this._clean_node_cache(); }; _remove_widget_if_present(node_id) { diff --git a/test_project/views/frontend/rendering.py b/test_project/views/frontend/rendering.py index 23a156ed..6b67746d 100644 --- a/test_project/views/frontend/rendering.py +++ b/test_project/views/frontend/rendering.py @@ -385,7 +385,27 @@ def step_06(self): @client_version(1, 2) def step_07(self): - self.set_step_label(7, 'Remove Node') + self.set_step_label(7, 'Move Node') + + moving_node = Div('node 3') + + self.rendering_root.nodes = [ + Div( + 'node 1', + moving_node, + ), + Div('node 2'), + ] + + self.show() + + self.rendering_root[1].append(moving_node) + + self.show() + + @client_version(1, 2) + def step_08(self): + self.set_step_label(8, 'Remove Node') self.rendering_root.nodes = [ Div('node 1'), @@ -396,8 +416,8 @@ def step_07(self): self.rendering_root.nodes[1].remove() @client_version(1, 2) - def step_08(self): - self.set_step_label(8, 'Slice Node List') + def step_09(self): + self.set_step_label(9, 'Slice Node List') self.rendering_root.nodes = [ Div('node 1'), @@ -413,94 +433,94 @@ def step_08(self): # id_list tests @client_version(1, 2) - def step_09(self): - self.set_step_label(9, 'Set id') + def step_10(self): + self.set_step_label(10, 'Set id') self.rendering_root.nodes = [ Div(_id='foo bar'), ] @client_version(1, 2) - def step_10(self): - self.set_step_label(10, 'Add id') + def step_11(self): + self.set_step_label(11, 'Add id') self.rendering_root.nodes[0].id_list.add('baz') @client_version(1, 2) - def step_11(self): - self.set_step_label(11, 'Remove id') + def step_12(self): + self.set_step_label(12, 'Remove id') self.rendering_root.nodes[0].id_list.remove('bar') @client_version(1, 2) - def step_12(self): - self.set_step_label(12, 'Reset id') + def step_13(self): + self.set_step_label(13, 'Reset id') self.rendering_root.nodes[0].id_list = ['foo1', 'bar1'] @client_version(1, 2) - def step_13(self): - self.set_step_label(13, 'Clear id') + def step_14(self): + self.set_step_label(14, 'Clear id') self.rendering_root.nodes[0].id_list.clear() # class_list tests @client_version(1, 2) - def step_14(self): - self.set_step_label(14, 'Set class') + def step_15(self): + self.set_step_label(15, 'Set class') self.rendering_root.nodes = [ Div(_class='foo bar'), ] @client_version(1, 2) - def step_15(self): - self.set_step_label(15, 'Add class') + def step_16(self): + self.set_step_label(16, 'Add class') self.rendering_root.nodes[0].class_list.add('baz') @client_version(1, 2) - def step_16(self): - self.set_step_label(16, 'Remove class') + def step_17(self): + self.set_step_label(17, 'Remove class') self.rendering_root.nodes[0].class_list.remove('bar') @client_version(1, 2) - def step_17(self): - self.set_step_label(17, 'Reset class') + def step_18(self): + self.set_step_label(18, 'Reset class') self.rendering_root.nodes[0].class_list = ['foo1', 'bar1'] @client_version(1, 2) - def step_18(self): - self.set_step_label(18, 'Clear class') + def step_19(self): + self.set_step_label(19, 'Clear class') self.rendering_root.nodes[0].class_list.clear() # attribute tests @client_version(1, 2) - def step_19(self): - self.set_step_label(19, 'Set attributes') + def step_20(self): + self.set_step_label(20, 'Set attributes') self.rendering_root.nodes = [ Div(foo='foo', bar='bar'), ] @client_version(1, 2) - def step_20(self): - self.set_step_label(20, 'Add attribute') + def step_21(self): + self.set_step_label(21, 'Add attribute') self.rendering_root.nodes[0].attributes['baz'] = 'baz' @client_version(1, 2) - def step_21(self): - self.set_step_label(21, 'Remove attribute') + def step_22(self): + self.set_step_label(22, 'Remove attribute') del self.rendering_root.nodes[0].attributes['foo'] @client_version(1, 2) - def step_22(self): - self.set_step_label(22, 'Reset attributes') + def step_23(self): + self.set_step_label(23, 'Reset attributes') self.rendering_root.nodes[0].attributes = { 'foo1': 'bar1', @@ -508,14 +528,14 @@ def step_22(self): } @client_version(1, 2) - def step_23(self): - self.set_step_label(23, 'Clear attributes') + def step_24(self): + self.set_step_label(24, 'Clear attributes') self.rendering_root.nodes[0].attributes.clear() @client_version(1, 2) - def step_24(self): - self.set_step_label(24, 'HTML Symbols') + def step_25(self): + self.set_step_label(25, 'HTML Symbols') self.rendering_root.nodes = [ '€', @@ -525,51 +545,51 @@ def step_24(self): # style tests @client_version(1, 2) - def step_25(self): - self.set_step_label(25, 'Empty style') + def step_26(self): + self.set_step_label(26, 'Empty style') self.rendering_root.nodes = [ Div(), ] @client_version(1, 2) - def step_26(self): - self.set_step_label(26, 'Set style') + def step_27(self): + self.set_step_label(27, 'Set style') self.rendering_root.nodes = [ Div(_style='top: 1px; right: 2px; --non-standard: 3;'), ] @client_version(1, 2) - def step_27(self): - self.set_step_label(27, 'Add style') + def step_28(self): + self.set_step_label(28, 'Add style') self.rendering_root.nodes[0].style['bottom'] = '3px' @client_version(1, 2) - def step_28(self): - self.set_step_label(28, 'Remove style') + def step_29(self): + self.set_step_label(29, 'Remove style') del self.rendering_root.nodes[0].style['top'] @client_version(1, 2) - def step_29(self): - self.set_step_label(29, 'Reset style') + def step_30(self): + self.set_step_label(30, 'Reset style') self.rendering_root.nodes[0].style = { 'left': '4px', } @client_version(1, 2) - def step_30(self): - self.set_step_label(30, 'Clear style') + def step_31(self): + self.set_step_label(31, 'Clear style') self.rendering_root.nodes[0].style.clear() # legacy widget api tests @client_version(1, 2) - def step_31(self): - self.set_step_label(31, 'Legacy Widget API: setup') + def step_32(self): + self.set_step_label(32, 'Legacy Widget API: setup') self.rendering_root.nodes = [ LegacyWidgetApiTestComponent( @@ -579,8 +599,8 @@ def step_31(self): ] @client_version(1, 2) - def step_32(self): - self.set_step_label(32, 'Legacy Widget API: data: list: append') + def step_33(self): + self.set_step_label(33, 'Legacy Widget API: data: list: append') component = self.rendering_root.nodes[0] @@ -590,8 +610,8 @@ def step_32(self): component.update_state() @client_version(1, 2) - def step_33(self): - self.set_step_label(33, 'Legacy Widget API: data: list: remove') + def step_34(self): + self.set_step_label(34, 'Legacy Widget API: data: list: remove') component = self.rendering_root.nodes[0] @@ -599,8 +619,8 @@ def step_33(self): component.update_state() @client_version(1, 2) - def step_34(self): - self.set_step_label(34, 'Legacy Widget API: data: list: insert') + def step_35(self): + self.set_step_label(35, 'Legacy Widget API: data: list: insert') component = self.rendering_root.nodes[0] @@ -608,8 +628,8 @@ def step_34(self): component.update_state() @client_version(1, 2) - def step_35(self): - self.set_step_label(35, 'Legacy Widget API: data: list: clear') + def step_36(self): + self.set_step_label(36, 'Legacy Widget API: data: list: clear') component = self.rendering_root.nodes[0] @@ -617,8 +637,8 @@ def step_35(self): component.update_state() @client_version(1, 2) - def step_36(self): - self.set_step_label(36, 'Legacy Widget API: data: list: reset') + def step_37(self): + self.set_step_label(37, 'Legacy Widget API: data: list: reset') component = self.rendering_root.nodes[0] @@ -626,8 +646,8 @@ def step_36(self): component.update_state() @client_version(1, 2) - def step_37(self): - self.set_step_label(37, 'Legacy Widget API: data: dict: setup') + def step_38(self): + self.set_step_label(38, 'Legacy Widget API: data: dict: setup') component = self.rendering_root.nodes[0] @@ -635,8 +655,8 @@ def step_37(self): component.update_state() @client_version(1, 2) - def step_38(self): - self.set_step_label(38, 'Legacy Widget API: data: dict: set') + def step_39(self): + self.set_step_label(39, 'Legacy Widget API: data: dict: set') component = self.rendering_root.nodes[0] @@ -646,8 +666,8 @@ def step_38(self): component.update_state() @client_version(1, 2) - def step_39(self): - self.set_step_label(39, 'Legacy Widget API: data: dict: del') + def step_40(self): + self.set_step_label(40, 'Legacy Widget API: data: dict: del') component = self.rendering_root.nodes[0] @@ -655,8 +675,8 @@ def step_39(self): component.update_state() @client_version(1, 2) - def step_40(self): - self.set_step_label(40, 'Legacy Widget API: data: dict: pop') + def step_41(self): + self.set_step_label(41, 'Legacy Widget API: data: dict: pop') component = self.rendering_root.nodes[0] @@ -664,8 +684,8 @@ def step_40(self): component.update_state() @client_version(1, 2) - def step_41(self): - self.set_step_label(41, 'Legacy Widget API: data: dict: clear') + def step_42(self): + self.set_step_label(42, 'Legacy Widget API: data: dict: clear') component = self.rendering_root.nodes[0] @@ -673,8 +693,8 @@ def step_41(self): component.update_state() @client_version(1, 2) - def step_42(self): - self.set_step_label(42, 'Legacy Widget API: data: dict: reset') + def step_43(self): + self.set_step_label(43, 'Legacy Widget API: data: dict: reset') component = self.rendering_root.nodes[0] @@ -682,15 +702,15 @@ def step_42(self): component.update_state() @client_version(1, 2) - def step_43(self): - self.set_step_label(43, 'Legacy Widget API: destroy') + def step_44(self): + self.set_step_label(44, 'Legacy Widget API: destroy') self.rendering_root.nodes.pop(0) # widget api tests @client_version(1, 2) - def step_44(self): - self.set_step_label(44, 'Widget API: setup') + def step_45(self): + self.set_step_label(45, 'Widget API: setup') self.rendering_root.nodes = [ WidgetApiTestComponent( @@ -700,8 +720,8 @@ def step_44(self): ] @client_version(1, 2) - def step_45(self): - self.set_step_label(45, 'Widget API: data: list: append') + def step_46(self): + self.set_step_label(46, 'Widget API: data: list: append') component = self.rendering_root.nodes[0] @@ -711,8 +731,8 @@ def step_45(self): component.update_state() @client_version(1, 2) - def step_46(self): - self.set_step_label(46, 'Widget API: data: list: remove') + def step_47(self): + self.set_step_label(47, 'Widget API: data: list: remove') component = self.rendering_root.nodes[0] @@ -720,8 +740,8 @@ def step_46(self): component.update_state() @client_version(1, 2) - def step_47(self): - self.set_step_label(47, 'Widget API: data: list: insert') + def step_48(self): + self.set_step_label(48, 'Widget API: data: list: insert') component = self.rendering_root.nodes[0] @@ -729,8 +749,8 @@ def step_47(self): component.update_state() @client_version(1, 2) - def step_48(self): - self.set_step_label(48, 'Widget API: data: list: clear') + def step_49(self): + self.set_step_label(49, 'Widget API: data: list: clear') component = self.rendering_root.nodes[0] @@ -738,8 +758,8 @@ def step_48(self): component.update_state() @client_version(1, 2) - def step_49(self): - self.set_step_label(49, 'Widget API: data: list: reset') + def step_50(self): + self.set_step_label(50, 'Widget API: data: list: reset') component = self.rendering_root.nodes[0] @@ -747,8 +767,8 @@ def step_49(self): component.update_state() @client_version(1, 2) - def step_50(self): - self.set_step_label(50, 'Widget API: data: dict: setup') + def step_51(self): + self.set_step_label(51, 'Widget API: data: dict: setup') component = self.rendering_root.nodes[0] @@ -756,8 +776,8 @@ def step_50(self): component.update_state() @client_version(1, 2) - def step_51(self): - self.set_step_label(51, 'Widget API: data: dict: set') + def step_52(self): + self.set_step_label(52, 'Widget API: data: dict: set') component = self.rendering_root.nodes[0] @@ -767,8 +787,8 @@ def step_51(self): component.update_state() @client_version(1, 2) - def step_52(self): - self.set_step_label(52, 'Widget API: data: dict: del') + def step_53(self): + self.set_step_label(53, 'Widget API: data: dict: del') component = self.rendering_root.nodes[0] @@ -776,8 +796,8 @@ def step_52(self): component.update_state() @client_version(1, 2) - def step_53(self): - self.set_step_label(53, 'Widget API: data: dict: pop') + def step_54(self): + self.set_step_label(54, 'Widget API: data: dict: pop') component = self.rendering_root.nodes[0] @@ -785,8 +805,8 @@ def step_53(self): component.update_state() @client_version(1, 2) - def step_54(self): - self.set_step_label(54, 'Widget API: data: dict: clear') + def step_55(self): + self.set_step_label(55, 'Widget API: data: dict: clear') component = self.rendering_root.nodes[0] @@ -794,8 +814,8 @@ def step_54(self): component.update_state() @client_version(1, 2) - def step_55(self): - self.set_step_label(55, 'Widget API: data: dict: reset') + def step_56(self): + self.set_step_label(56, 'Widget API: data: dict: reset') component = self.rendering_root.nodes[0] @@ -803,15 +823,15 @@ def step_55(self): component.update_state() @client_version(1, 2) - def step_56(self): - self.set_step_label(56, 'Widget API: destroy') + def step_57(self): + self.set_step_label(57, 'Widget API: destroy') self.rendering_root.nodes.pop(0) # raw html ################################################################ @client_version(1, 2) - def step_57(self): - self.set_step_label(57, 'Raw HTML: Setup') + def step_58(self): + self.set_step_label(58, 'Raw HTML: Setup') self.rendering_root.nodes = [ Div( @@ -822,16 +842,16 @@ def step_57(self): ] @client_version(1, 2) - def step_58(self): - self.set_step_label(58, 'Raw HTML: Reset') + def step_59(self): + self.set_step_label(59, 'Raw HTML: Reset') self.rendering_root.nodes[0][0].inner_html = """
Second Raw HTML
""" @client_version(1, 2) - def step_59(self): - self.set_step_label(59, 'Raw HTML: Clear') + def step_60(self): + self.set_step_label(60, 'Raw HTML: Clear') self.rendering_root.nodes[0].clear() @@ -839,8 +859,8 @@ def step_59(self): # TODO: remove in 2.0 @client_version(1) - def step_60(self): - self.set_step_label(60, 'Legacy Widgets: Setup') + def step_61(self): + self.set_step_label(61, 'Legacy Widgets: Setup') self.rendering_root.clear() @@ -857,8 +877,8 @@ def step_60(self): ] @client_version(1) - def step_61(self): - self.set_step_label(61, 'Legacy Widgets: Append Nodes') + def step_62(self): + self.set_step_label(62, 'Legacy Widgets: Append Nodes') widget1 = self.rendering_root.nodes[0] widget1.append(Div('1.3')) @@ -869,8 +889,8 @@ def step_61(self): self.rendering_root.append(Div('4.1')) @client_version(1) - def step_62(self): - self.set_step_label(62, 'Legacy Widgets: Set Nodes') + def step_63(self): + self.set_step_label(63, 'Legacy Widgets: Set Nodes') widget1 = self.rendering_root.nodes[0] widget1.nodes[1] = Div('1.2.1') @@ -879,8 +899,8 @@ def step_62(self): widget1.nodes[1] = Div('3.2.1') @client_version(1) - def step_63(self): - self.set_step_label(63, 'Legacy Widgets: Reset Nodes') + def step_64(self): + self.set_step_label(64, 'Legacy Widgets: Reset Nodes') widget1 = self.rendering_root.nodes[0] @@ -903,8 +923,8 @@ def step_63(self): self.rendering_root[3] = Div('4.1.1') @client_version(1) - def step_64(self): - self.set_step_label(64, 'Legacy Widgets: Insert Nodes') + def step_65(self): + self.set_step_label(65, 'Legacy Widgets: Insert Nodes') widget1 = self.rendering_root[0] widget1.nodes.insert(2, Div('1.2.1.1')) @@ -915,8 +935,8 @@ def step_64(self): widget2.nodes.insert(2, Div('3.2.1.1')) @client_version(1) - def step_65(self): - self.set_step_label(65, 'Legacy Widgets: Remove Nodes') + def step_66(self): + self.set_step_label(66, 'Legacy Widgets: Remove Nodes') widget1 = self.rendering_root[0] widget1.nodes.pop(2) @@ -926,8 +946,8 @@ def step_65(self): # legacy frontend widget api tests @client_version(1) - def step_66(self): - self.set_step_label(66, 'Legacy Frontend Widget API: setup') + def step_67(self): + self.set_step_label(67, 'Legacy Frontend Widget API: setup') self.rendering_root.nodes = [ LegacyFrontendWidgetTestComponent( @@ -937,8 +957,8 @@ def step_66(self): ] @client_version(1) - def step_67(self): - self.set_step_label(67, 'Legacy Frontend Widget API: data: list: append') + def step_68(self): + self.set_step_label(68, 'Legacy Frontend Widget API: data: list: append') component = self.rendering_root.nodes[0] @@ -948,8 +968,8 @@ def step_67(self): component.update_state() @client_version(1) - def step_68(self): - self.set_step_label(68, 'Legacy Frontend Widget API: data: list: remove') + def step_69(self): + self.set_step_label(69, 'Legacy Frontend Widget API: data: list: remove') component = self.rendering_root.nodes[0] @@ -957,8 +977,8 @@ def step_68(self): component.update_state() @client_version(1) - def step_69(self): - self.set_step_label(69, 'Legacy Frontend Widget API: data: list: insert') + def step_70(self): + self.set_step_label(70, 'Legacy Frontend Widget API: data: list: insert') component = self.rendering_root.nodes[0] @@ -966,8 +986,8 @@ def step_69(self): component.update_state() @client_version(1) - def step_70(self): - self.set_step_label(70, 'Legacy Frontend Widget API: data: list: clear') + def step_71(self): + self.set_step_label(71, 'Legacy Frontend Widget API: data: list: clear') component = self.rendering_root.nodes[0] @@ -975,8 +995,8 @@ def step_70(self): component.update_state() @client_version(1) - def step_71(self): - self.set_step_label(71, 'Legacy Frontend Widget API: data: list: reset') + def step_72(self): + self.set_step_label(72, 'Legacy Frontend Widget API: data: list: reset') component = self.rendering_root.nodes[0] @@ -984,8 +1004,8 @@ def step_71(self): component.update_state() @client_version(1) - def step_72(self): - self.set_step_label(72, 'Legacy Frontend Widget API: data: dict: setup') + def step_73(self): + self.set_step_label(73, 'Legacy Frontend Widget API: data: dict: setup') component = self.rendering_root.nodes[0] @@ -993,8 +1013,8 @@ def step_72(self): component.update_state() @client_version(1) - def step_73(self): - self.set_step_label(73, 'Legacy Frontend Widget API: data: dict: set') + def step_74(self): + self.set_step_label(74, 'Legacy Frontend Widget API: data: dict: set') component = self.rendering_root.nodes[0] @@ -1004,8 +1024,8 @@ def step_73(self): component.update_state() @client_version(1) - def step_74(self): - self.set_step_label(74, 'Legacy Frontend Widget API: data: dict: del') + def step_75(self): + self.set_step_label(75, 'Legacy Frontend Widget API: data: dict: del') component = self.rendering_root.nodes[0] @@ -1013,8 +1033,8 @@ def step_74(self): component.update_state() @client_version(1) - def step_75(self): - self.set_step_label(75, 'Legacy Frontend Widget API: data: dict: pop') + def step_76(self): + self.set_step_label(76, 'Legacy Frontend Widget API: data: dict: pop') component = self.rendering_root.nodes[0] @@ -1022,8 +1042,8 @@ def step_75(self): component.update_state() @client_version(1) - def step_76(self): - self.set_step_label(76, 'Legacy Frontend Widget API: data: dict: clear') + def step_77(self): + self.set_step_label(77, 'Legacy Frontend Widget API: data: dict: clear') component = self.rendering_root.nodes[0] @@ -1031,8 +1051,8 @@ def step_76(self): component.update_state() @client_version(1) - def step_77(self): - self.set_step_label(77, 'Legacy Frontend Widget API: data: dict: reset') + def step_78(self): + self.set_step_label(78, 'Legacy Frontend Widget API: data: dict: reset') component = self.rendering_root.nodes[0] @@ -1040,7 +1060,7 @@ def step_77(self): component.update_state() @client_version(1) - def step_78(self): - self.set_step_label(78, 'Legacy Frontend Widget API: destroy') + def step_79(self): + self.set_step_label(79, 'Legacy Frontend Widget API: destroy') self.rendering_root.nodes.pop(0) diff --git a/tests/test_0304_rendering.py b/tests/test_0304_rendering.py index af88da6b..eee56d6a 100644 --- a/tests/test_0304_rendering.py +++ b/tests/test_0304_rendering.py @@ -100,7 +100,7 @@ async def get_widget_hooks(page): rendering_root_element = page.locator('#lona #rendering-root') # DOM tests ########################################################### - for step in range(1, 24): + for step in range(1, 25): await next_step(page, step) # get rendered html @@ -115,7 +115,7 @@ async def get_widget_hooks(page): assert html.nodes == context.server.state['rendering-root'].nodes # html symbols - await next_step(page, 24) + await next_step(page, 25) html_string = await rendering_root_element.inner_html() @@ -123,12 +123,12 @@ async def get_widget_hooks(page): # CSS tests ########################################################### - # 23 Empty style - await next_step(page, 25) + # 26 Empty style + await next_step(page, 26) await check_empty_client_style(page) - # 24 Set Style - await next_step(page, 26) + # 27 Set Style + await next_step(page, 27) client_style = await get_client_style(page) @@ -136,8 +136,8 @@ async def get_widget_hooks(page): assert client_style['right'] == '2px' assert client_style['--non-standard'] == '3' - # 25 Add Style - await next_step(page, 27) + # 28 Add Style + await next_step(page, 28) client_style = await get_client_style(page) style = get_server_style() @@ -147,8 +147,8 @@ async def get_widget_hooks(page): assert client_style['--non-standard'] == '3' assert client_style['bottom'] == '3px' - # 26 Remove Style - await next_step(page, 28) + # 29 Remove Style + await next_step(page, 29) client_style = await get_client_style(page) style = get_server_style() @@ -159,8 +159,8 @@ async def get_widget_hooks(page): assert client_style['bottom'] == '3px' assert client_style['--non-standard'] == '3' - # 27 Reset Style - await next_step(page, 29) + # 30 Reset Style + await next_step(page, 30) client_style = await get_client_style(page) style = get_server_style() @@ -170,13 +170,13 @@ async def get_widget_hooks(page): assert client_style['left'] == '4px' - # 28 Clear Style - await next_step(page, 30) + # 31 Clear Style + await next_step(page, 31) await check_empty_client_style(page) # legacy widget API ################################################### # TODO: remove in 2.0 - for step in range(31, 43): + for step in range(32, 44): await next_step(page, step) # widget hooks @@ -196,12 +196,12 @@ async def get_widget_hooks(page): assert server_widget_data == client_widget_data # destroy - await next_step(page, 43) + await next_step(page, 44) assert (await get_widget_hooks(page)) == 'constructor,setup,deconstruct' # widget API ########################################################## - for step in range(44, 56): + for step in range(45, 57): await next_step(page, step) # widget hooks @@ -221,12 +221,12 @@ async def get_widget_hooks(page): assert server_widget_data == client_widget_data # destroy - await next_step(page, 56) + await next_step(page, 57) assert (await get_widget_hooks(page)) == 'constructor,destroy' # raw HTML tests ###################################################### - for step in range(57, 60): + for step in range(58, 61): await next_step(page, step) client_html_string = await rendering_root_element.inner_html() @@ -242,7 +242,7 @@ async def get_widget_hooks(page): if get_client_version() != 1: return - for step in range(60, 66): + for step in range(61, 67): await next_step(page, step) client_html_string = await rendering_root_element.inner_html() @@ -253,7 +253,7 @@ async def get_widget_hooks(page): assert client_html.nodes == server_html.nodes # legacy frontend widgets data tests ################################## - for step in range(66, 78): + for step in range(67, 79): await next_step(page, step) # widget hooks @@ -273,6 +273,6 @@ async def get_widget_hooks(page): assert server_widget_data == client_widget_data # destroy - await next_step(page, 78) + await next_step(page, 79) assert (await get_widget_hooks(page)) == 'constructor,setup,deconstruct'