Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ReactWindows/ReactNative.Tests/ReactNative.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@
<Compile Include="UIManager\Events\EventDispatcherTests.cs" />
<Compile Include="UIManager\Events\EventTests.cs" />
<Compile Include="UIManager\Events\RCTEventEmitterTests.cs" />
<Compile Include="UIManager\FrameworkElementExtensionsTests.cs" />
<Compile Include="UIManager\PropertySetterTests.cs" />
<Compile Include="UIManager\RootViewHelperTests.cs" />
<Compile Include="UIManager\ShadowNodeRegistryTests.cs" />
<Compile Include="UIManager\UIManagerModuleTests.cs" />
<Compile Include="UIManager\ViewAtIndexTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using ReactNative.Bridge;
using ReactNative.UIManager;
using System;
using Windows.UI.Xaml.Controls;

namespace ReactNative.Tests.UIManager
{
[TestClass]
public class FrameworkElementExtensionsTests
{
[Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer.UITestMethod]
public void FrameworkElementExtensions_ArgumentChecks()
{
var element = new Button();

AssertEx.Throws<ArgumentNullException>(
() => FrameworkElementExtensions.SetTag(null, 0),
ex => Assert.AreEqual("view", ex.ParamName));

AssertEx.Throws<ArgumentNullException>(
() => FrameworkElementExtensions.SetReactContext(null, null),
ex => Assert.AreEqual("view", ex.ParamName));

AssertEx.Throws<ArgumentNullException>(
() => FrameworkElementExtensions.GetTag(null),
ex => Assert.AreEqual("view", ex.ParamName));

AssertEx.Throws<ArgumentNullException>(
() => FrameworkElementExtensions.GetReactContext(null),
ex => Assert.AreEqual("view", ex.ParamName));
}

[Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer.UITestMethod]
public void FrameworkElementExtensions_ExistingTag()
{
var button = new Button();
button.Tag = new object();

AssertEx.Throws<InvalidOperationException>(() => button.SetTag(1));
AssertEx.Throws<InvalidOperationException>(() => button.SetReactContext(null));
}

[Microsoft.VisualStudio.TestPlatform.UnitTestFramework.AppContainer.UITestMethod]
public void FrameworkElementExtensions_Get_Set()
{
var button = new Button();

button.SetTag(42);
Assert.AreEqual(42, button.GetTag());

button.SetReactContext(null);
Assert.IsNull(button.GetReactContext());
}

}
}
15 changes: 15 additions & 0 deletions ReactWindows/ReactNative.Tests/UIManager/PropertySetterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,21 @@ public ReactShadowNode CreateShadowNodeInstance()
throw new NotImplementedException();
}

public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}

public void UpdateProperties(FrameworkElement viewToUpdate, CatalystStylesDiffMap properties)
{
throw new NotImplementedException();
Expand Down
24 changes: 24 additions & 0 deletions ReactWindows/ReactNative.Tests/UIManager/RootViewHelperTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using ReactNative.UIManager;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace ReactNative.Tests.UIManager
{
[TestClass]
public class RootViewHelperTests
{
[TestMethod]
public void RootViewHelper_Null()
{
Assert.IsNull(RootViewHelper.GetRootView(null));
}

class TestRootView : Panel, IRootView
{
public void OnChildStartedNativeGesture(RoutedEventArgs ev)
{
}
}
}
}
16 changes: 16 additions & 0 deletions ReactWindows/ReactNative.Tests/UIManager/UIManagerModuleTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Newtonsoft.Json.Linq;
using ReactNative.Bridge;
using ReactNative.Tests.Constants;
using ReactNative.UIManager;
Expand Down Expand Up @@ -132,6 +133,21 @@ public ReactShadowNode CreateShadowNodeInstance()
return null;
}

public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}

public void UpdateExtraData(FrameworkElement viewToUpdate, object extraData)
{
throw new NotImplementedException();
Expand Down
6 changes: 3 additions & 3 deletions ReactWindows/ReactNative.Tests/UIManager/ViewAtIndexTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ public void ViewAtIndex_Comparator()
var v1 = new ViewAtIndex(17, 6);
var v2 = new ViewAtIndex(42, 17);

Assert.IsTrue(ViewAtIndex.Comparer.Compare(v1, v2) < 0);
Assert.IsTrue(ViewAtIndex.Comparer.Compare(v2, v1) > 0);
Assert.AreEqual(0, ViewAtIndex.Comparer.Compare(v1, v1));
Assert.IsTrue(ViewAtIndex.IndexComparer.Compare(v1, v2) < 0);
Assert.IsTrue(ViewAtIndex.IndexComparer.Compare(v2, v1) > 0);
Assert.AreEqual(0, ViewAtIndex.IndexComparer.Compare(v1, v1));
}

[TestMethod]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Newtonsoft.Json.Linq;
using ReactNative.UIManager;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -90,6 +91,21 @@ public ReactShadowNode CreateShadowNodeInstance()
throw new NotImplementedException();
}

public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}

public void UpdateExtraData(FrameworkElement viewToUpdate, object extraData)
{
throw new NotImplementedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,39 +190,41 @@ public void ViewManagersPropertyCache_Defaults()

class EmptyTest : IViewManager
{
public IReadOnlyDictionary<string, object> CommandsMap
#region IViewManager

public string Name
{
get
{
throw new NotImplementedException();
}
}

public IReadOnlyDictionary<string, object> ExportedCustomBubblingEventTypeConstants
public IReadOnlyDictionary<string, object> CommandsMap
{
get
{
throw new NotImplementedException();
}
}

public IReadOnlyDictionary<string, object> ExportedCustomDirectEventTypeConstants
public IReadOnlyDictionary<string, object> ExportedCustomBubblingEventTypeConstants
{
get
{
throw new NotImplementedException();
}
}

public IReadOnlyDictionary<string, object> ExportedViewConstants
public IReadOnlyDictionary<string, object> ExportedCustomDirectEventTypeConstants
{
get
{
throw new NotImplementedException();
}
}

public string Name
public IReadOnlyDictionary<string, object> ExportedViewConstants
{
get
{
Expand All @@ -243,7 +245,17 @@ public ReactShadowNode CreateShadowNodeInstance()
throw new NotImplementedException();
}

public void UpdateExtraData(FrameworkElement viewToUpdate, object extraData)
public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}
Expand All @@ -252,6 +264,13 @@ public void UpdateProperties(FrameworkElement viewToUpdate, CatalystStylesDiffMa
{
throw new NotImplementedException();
}

public void UpdateExtraData(FrameworkElement viewToUpdate, object extraData)
{
throw new NotImplementedException();
}

#endregion
}

class ViewManagerValueTest : IViewManager
Expand All @@ -272,7 +291,7 @@ public void Bar(FrameworkElement element, int index, string value)
BarValues[index] = value;
}

#region IViewManager Implementation
#region IViewManager

public string Name
{
Expand Down Expand Up @@ -327,6 +346,21 @@ public ReactShadowNode CreateShadowNodeInstance()
throw new NotImplementedException();
}

public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}

public void UpdateProperties(FrameworkElement viewToUpdate, CatalystStylesDiffMap properties)
{
throw new NotImplementedException();
Expand Down Expand Up @@ -540,6 +574,21 @@ public ReactShadowNode CreateShadowNodeInstance()
throw new NotImplementedException();
}

public FrameworkElement CreateView(ThemedReactContext themedContext, JavaScriptResponderHandler jsResponderHandler)
{
throw new NotImplementedException();
}

public void OnDropViewInstance(ThemedReactContext themedReactContext, FrameworkElement view)
{
throw new NotImplementedException();
}

public void ReceiveCommand(FrameworkElement view, int commandId, JArray args)
{
throw new NotImplementedException();
}

public void UpdateProperties(FrameworkElement viewToUpdate, CatalystStylesDiffMap properties)
{
throw new NotImplementedException();
Expand Down
2 changes: 0 additions & 2 deletions ReactWindows/ReactNative/IReactInstanceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public interface IReactInstanceManager : IDisposable

//public abstract void onResume(DefaultHardwareBackBtnHandler defaultBackButtonImpl);

void Dispose();

/// <summary>
/// Attach given {@param rootView} to a catalyst instance manager and start JS application
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions ReactWindows/ReactNative/ReactNative.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
<Compile Include="Shell\MainReactPackage.cs" />
<Compile Include="Touch\JSResponderHandler.cs" />
<Compile Include="Touch\OnInterceptTouchEventListener.cs" />
<Compile Include="UIManager\Animation\AnimationRegistry.cs" />
<Compile Include="UIManager\CatalystStylesDiffMap.cs" />
<Compile Include="CSSLayout\CSSLayoutContext.cs" />
<Compile Include="UIManager\Events\Event.cs" />
Expand All @@ -207,6 +208,9 @@
<Compile Include="UIManager\AppRegistry.cs" />
<Compile Include="UIManager\Events\TouchEventType.cs" />
<Compile Include="UIManager\Events\TouchEventTypeExtensions.cs" />
<Compile Include="UIManager\RootViewHelper.cs" />
<Compile Include="UIManager\TouchTargetHelper.cs" />
<Compile Include="UIManager\FrameworkElementExtensions.cs" />
<Compile Include="UIManager\ICatalystInterceptingViewGroup.cs" />
<Compile Include="UIManager\IPropertySetter.cs" />
<Compile Include="UIManager\IViewManager.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ReactNative.UIManager.Animation
{
public class AnimationRegistry
{
public AnimationRegistry()
{
}
}
}
Loading