Skip to content

Commit d15922e

Browse files
committed
Change 'callback' to 'window.callback' per Prusse's suggestion
1 parent 8d8175e commit d15922e

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

tests/conftest.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,9 @@ def __init__(self, selenium, host):
300300
' window.__added__.push.apply(window.__added__, cellIds);'
301301
'}'
302302
)
303-
self.eval_js_function('api.registerCellsAddedHandler', qmxgraph.js.Variable('callback'))
303+
self.eval_js_function(
304+
'api.registerCellsAddedHandler', qmxgraph.js.Variable('window.callback')
305+
)
304306

305307
selenium.execute_script(
306308
'callback = function(cellId, newLabel, oldLabel) {'
@@ -310,7 +312,9 @@ def __init__(self, selenium, host):
310312
' window.__labels__.push({cellId: cellId, newLabel: newLabel, oldLabel: oldLabel});' # noqa
311313
'}'
312314
)
313-
self.eval_js_function('api.registerLabelChangedHandler', qmxgraph.js.Variable('callback'))
315+
self.eval_js_function(
316+
'api.registerLabelChangedHandler', qmxgraph.js.Variable('window.callback')
317+
)
314318

315319
def get_container(self):
316320
"""

tests/test_js_graph.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ def test_on_cells_removed(graph_cases) -> None:
683683
graph = graph_cases('2v_1e')
684684

685685
graph.selenium.execute_script('callback = function(cellIds) {window.cellIds = cellIds;}')
686-
graph.eval_js_function('api.registerCellsRemovedHandler', js.Variable('callback'))
686+
graph.eval_js_function('api.registerCellsRemovedHandler', js.Variable('window.callback'))
687687

688688
cell_ids = [
689689
graph.get_id(graph.get_vertices()[0]),
@@ -899,7 +899,7 @@ def test_insert_with_tags(graph_cases, cell_type) -> None:
899899
' );'
900900
'}'
901901
)
902-
graph.eval_js_function('api.registerCellsAddedHandler', js.Variable('callback'))
902+
graph.eval_js_function('api.registerCellsAddedHandler', js.Variable('window.callback'))
903903
tags = {'tagTest': '1'}
904904

905905
cell_id = insert_by_parametrized_type(graph, cell_type, tags=tags)
@@ -1194,7 +1194,9 @@ def test_set_double_click_handler(graph_cases) -> None:
11941194
' window.__dblClick__.push(cellId);'
11951195
'}'
11961196
)
1197-
graph.eval_js_function('api.registerDoubleClickHandler', qmxgraph.js.Variable('callback'))
1197+
graph.eval_js_function(
1198+
'api.registerDoubleClickHandler', qmxgraph.js.Variable('window.callback')
1199+
)
11981200

11991201
actions = ActionChains(graph.selenium)
12001202
actions.double_click(graph.get_vertex())
@@ -1220,7 +1222,9 @@ def test_add_selection_change_handler(graph_cases) -> None:
12201222
' window.__selectionChange__.push(cellIds);'
12211223
'}'
12221224
)
1223-
graph.eval_js_function('api.registerSelectionChangedHandler', qmxgraph.js.Variable('callback'))
1225+
graph.eval_js_function(
1226+
'api.registerSelectionChangedHandler', qmxgraph.js.Variable('window.callback')
1227+
)
12241228

12251229
# Select all cells.
12261230
actions = ActionChains(graph.selenium)
@@ -1271,7 +1275,7 @@ def test_set_popup_menu_handler(graph_cases) -> None:
12711275
' window.__popupMenu__.push([cellId, x, y]);'
12721276
'}'
12731277
)
1274-
graph.eval_js_function('api.registerPopupMenuHandler', qmxgraph.js.Variable('callback'))
1278+
graph.eval_js_function('api.registerPopupMenuHandler', qmxgraph.js.Variable('window.callback'))
12751279

12761280
vertex_label_el = graph.get_label_element(graph.get_vertex())
12771281
actions = ActionChains(graph.selenium)

0 commit comments

Comments
 (0)