public async Task TwoWay_should_clean_javascriptObject_listeners_when_object_is_not_part_of_the_graph_js() { var datacontext = new BasicFatherVm(); var child = new BasicVm(); datacontext.Child = child; var test = new TestInContextAsync() { Bind = (win) => Bind(win, datacontext, JavascriptBindingMode.TwoWay), Test = async(mb) => { var js = mb.JSRootObject; var childJs = GetAttribute(js, "Child"); CheckReadOnly(childJs, false); var nullJs = Factory.CreateNull(); SetAttribute(js, "Child", nullJs); await Task.Delay(150); DoSafeUI(() => datacontext.Child.Should().BeNull()); child.ListenerCount.Should().Be(0); CheckHasListener(childJs, false); } }; await RunAsync(test); }
public async Task TwoWay_should_clean_javascriptObject_listeners_when_object_is_not_part_of_the_graph_array_js_context() { var datacontext = new BasicListVm(); var child = new BasicVm(); datacontext.Children.Add(child); var test = new TestInContextAsync() { Bind = (win) => Bind(win, datacontext, JavascriptBindingMode.TwoWay), Test = async(mb) => { var js = mb.JSRootObject; CheckReadOnly(js, true); var childrenJs = GetCollectionAttribute(js, "Children"); var childJs = childrenJs.GetValue(0); CheckReadOnly(childJs, false); Call(childrenJs, "pop"); await Task.Delay(150); CheckHasListener(childJs, false); } }; await RunAsync(test); }
public async Task TwoWay_should_clean_javascriptObject_listeners_when_object_is_not_part_of_the_graph(BasicVm remplacementChild) { var datacontext = new BasicFatherVm(); var child = new BasicVm(); datacontext.Child = child; var test = new TestInContextAsync() { Bind = (win) => Bind(win, datacontext, JavascriptBindingMode.TwoWay), Test = async(mb) => { var js = mb.JSRootObject; var childJs = GetAttribute(js, "Child"); CheckReadOnly(childJs, false); DoSafeUI(() => datacontext.Child = remplacementChild); await Task.Delay(150); CheckHasListener(childJs, false); } }; await RunAsync(test); }