def test_widget_link_target_param_not_found(): t1 = TextInput() t2 = TextInput() with pytest.raises(ValueError) as excinfo: t1.jslink(t2, value='value1') assert "Could not jslink \'value1\' parameter" in str(excinfo)
def test_widget_link_no_target_transform_error(): t1 = DatetimeInput() t2 = TextInput() with pytest.raises(ValueError) as excinfo: t2.jslink(t1, value='value') assert ("Cannot jslink \'value\' parameter on TextInput object " "to \'value\' parameter on DatetimeInput object") in str(excinfo)
def test_widget_link_bidirectional(document, comm): t1 = TextInput() t2 = TextInput() t1.jslink(t2, value='value', bidirectional=True) row = Row(t1, t2) model = row.get_root(document, comm) tm1, tm2 = model.children link1_customjs = tm1.js_property_callbacks['change:value'][-1] link2_customjs = tm2.js_property_callbacks['change:value'][-1] assert link1_customjs.args['source'] is tm1 assert link2_customjs.args['source'] is tm2 assert link1_customjs.args['target'] is tm2 assert link2_customjs.args['target'] is tm1