Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting unused files, less Catalyst more React, and other polish #142

Closed
wants to merge 10 commits into from
3 changes: 0 additions & 3 deletions .vscode/settings.json

This file was deleted.

4 changes: 2 additions & 2 deletions ReactWindows/Playground/Resources/main.dev.jsbundle
Original file line number Diff line number Diff line change
Expand Up @@ -1196,12 +1196,12 @@ return (
React.createElement(View,{elevation:'1.0'},
React.createElement(View,{style:{marginLeft:20}},
React.createElement(View,{style:{borderLeftWidth:5,borderRightWidth:10,borderTopWidth:2, borderBottomWidth: 8}},
React.createElement(View,{style:{margin:10,borderWidth:10,borderRadius:5,borderLeftColor:'red',borderRightColor:'blue',borderTopColor:'yellow',borderBottomColor:'green'}},
React.createElement(View,{style:{margin:10,borderWidth:10,borderRadius:20,borderColor:'red'}},
React.createElement(View,{style:{padding:10,flexDirection:'row'}},
React.createElement(Switch,null),
React.createElement(Text,{style:{color:'orange',flex:1}},"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Curabitur sodales ligula in libero. Sed dignissim lacinia nunc. Curabitur tortor. Pellentesque nibh. Aenean quam. In scelerisque sem at dolor. Maecenas mattis. Sed convallis tristique sem. Proin ut ligula vel nunc egestas porttitor. Morbi lectus risus, iaculis vel, suscipit quis, luctus non, massa. Fusce ac turpis quis ligula lacinia aliquet. Mauris ipsum. Nulla metus metus, ullamcorper vel, tincidunt sed, euismod in, nibh. Quisque volutpat condimentum velit. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam nec ante. Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. Sed non quam. In vel mi sit amet augue congue elementum. Morbi in ipsum sit amet pede facilisis laoreet. Donec lacus nunc, viverra nec.")),
React.createElement(View,null,
React.createElement(TextInput,{style:{height:40,color:'purple',borderWidth:5,borderColor:'purple'}})))))));}});
React.createElement(TextInput,{style:{margin:10,height:40,color:'purple',borderWidth:5,borderColor:'purple'}})))))));}});



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ public class JavaScriptModuleRegistryTests
[TestMethod]
public void JavaScriptModuleRegistry_ArgumentChecks()
{
var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
var config = new JavaScriptModulesConfig.Builder().Build();

AssertEx.Throws<ArgumentNullException>(
() => new JavaScriptModuleRegistry(null, config),
ex => Assert.AreEqual("catalystInstance", ex.ParamName));
ex => Assert.AreEqual("reactInstance", ex.ParamName));

AssertEx.Throws<ArgumentNullException>(
() => new JavaScriptModuleRegistry(catalystInstance, null),
() => new JavaScriptModuleRegistry(reactInstance, null),
ex => Assert.AreEqual("config", ex.ParamName));
}

Expand All @@ -41,15 +41,15 @@ public void JavaScriptModuleRegistry_Invoke()
var moduleIds = new List<int>();
var methodIds = new List<int>();
var argsList = new List<JArray>();
var catalystInstance = new MockCatalystInstance((moduleId, methodId, args, tracingName) =>
var reactInstance = new MockReactInstance((moduleId, methodId, args, tracingName) =>
{
moduleIds.Add(moduleId);
methodIds.Add(methodId);
argsList.Add(args);
are.Set();
});

var registry = new JavaScriptModuleRegistry(catalystInstance, config);
var registry = new JavaScriptModuleRegistry(reactInstance, config);
var module = registry.GetJavaScriptModule<TestJavaScriptModule>();

module.Foo(42);
Expand All @@ -71,8 +71,8 @@ public void JavaScriptModuleRegistry_Invoke()
public void JavaScriptModuleRegistry_InvalidModule_Throws()
{
var config = new JavaScriptModulesConfig.Builder().Build();
var catalystInstance = new MockCatalystInstance();
var registry = new JavaScriptModuleRegistry(catalystInstance, config);
var reactInstance = new MockReactInstance();
var registry = new JavaScriptModuleRegistry(reactInstance, config);
AssertEx.Throws<InvalidOperationException>(() => registry.GetJavaScriptModule<TestJavaScriptModule>());
}

Expand Down
66 changes: 33 additions & 33 deletions ReactWindows/ReactNative.Tests/Bridge/NativeModuleBaseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ public void NativeModuleBase_Invocation_ArgumentNull()

testModule.Initialize();

var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
AssertEx.Throws<ArgumentNullException>(
() => testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(null, new JArray()),
ex => Assert.AreEqual("catalystInstance", ex.ParamName));
ex => Assert.AreEqual("reactInstance", ex.ParamName));
AssertEx.Throws<ArgumentNullException>(
() => testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(catalystInstance, null),
() => testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(reactInstance, null),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -60,9 +60,9 @@ public void NativeModuleBase_Invocation_ArgumentInvalidCount()

testModule.Initialize();

var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
AssertEx.Throws<NativeArgumentsParseException>(
() => testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(catalystInstance, new JArray()),
() => testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(reactInstance, new JArray()),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -73,9 +73,9 @@ public void NativeModuleBase_Invocation_ArgumentConversionException()

testModule.Initialize();

var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
AssertEx.Throws<NativeArgumentsParseException>(
() => testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(catalystInstance, JArray.FromObject(new[] { default(object) })),
() => testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(reactInstance, JArray.FromObject(new[] { default(object) })),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -90,13 +90,13 @@ public void NativeModuleBase_Invocation()

Assert.AreEqual(2, testModule.Methods.Count);

var catalystInstance = new MockCatalystInstance();
testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(catalystInstance, new JArray());
testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(catalystInstance, new JArray());
var reactInstance = new MockReactInstance();
testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(reactInstance, new JArray());
testModule.Methods[nameof(TestNativeModule.Foo)].Invoke(reactInstance, new JArray());
Assert.AreEqual(2, fooCount);

testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(catalystInstance, JArray.FromObject(new[] { 42 }));
testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(catalystInstance, JArray.FromObject(new[] { 17 }));
testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(reactInstance, JArray.FromObject(new[] { 42 }));
testModule.Methods[nameof(TestNativeModule.Bar)].Invoke(reactInstance, JArray.FromObject(new[] { 17 }));
Assert.AreEqual(59, barSum);
}

Expand All @@ -110,13 +110,13 @@ public void NativeModuleBase_Invocation_Callbacks()
var id = default(int);
var args = default(List<int>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<int>>();
});

module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42 }));
module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42 }));
Assert.AreEqual(42, id);
Assert.IsTrue(args.Cast<object>().SequenceEqual(callbackArgs));
}
Expand All @@ -131,14 +131,14 @@ public void NativeModuleBase_Invocation_Callbacks_InvalidArgumentThrows()
var id = default(int);
var args = default(List<int>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<int>>();
});

AssertEx.Throws<NativeArgumentsParseException>(
() => module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { default(object) })),
() => module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { default(object) })),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -151,13 +151,13 @@ public void NativeModuleBase_Invocation_Callbacks_NullCallback()
var id = default(int);
var args = default(List<int>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<int>>();
});

module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42 }));
module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42 }));
Assert.AreEqual(0, args.Count);
}

Expand All @@ -170,13 +170,13 @@ public void NativeModuleBase_Invocation_Promises_Resolve()
var id = default(int);
var args = default(List<int>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<int>>();
});

module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42, 43 }));
module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42, 43 }));
Assert.AreEqual(42, id);
Assert.IsTrue(args.SequenceEqual(new[] { 17 }));
}
Expand All @@ -185,15 +185,15 @@ public void NativeModuleBase_Invocation_Promises_Resolve()
public void NativeModuleBase_CompiledDelegateFactory_Perf()
{
var module = new PerfNativeModule(CompiledReactDelegateFactory.Instance);
var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
var args = JArray.FromObject(new[] { 42 });

module.Initialize();

var n = 100000;
for (var i = 0; i < n; ++i)
{
module.Methods[nameof(PerfNativeModule.Foo)].Invoke(catalystInstance, args);
module.Methods[nameof(PerfNativeModule.Foo)].Invoke(reactInstance, args);
}
}

Expand All @@ -206,18 +206,18 @@ public void NativeModuleBase_Invocation_Promises_InvalidArgumentThrows()
var id = default(int);
var args = default(List<int>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<int>>();
});

AssertEx.Throws<NativeArgumentsParseException>(
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { default(object), 43 })),
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { default(object), 43 })),
ex => Assert.AreEqual("jsArguments", ex.ParamName));

AssertEx.Throws<NativeArgumentsParseException>(
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42, default(object) })),
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42, default(object) })),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -230,14 +230,14 @@ public void NativeModuleBase_Invocation_Promises_IncorrectArgumentCount()
var id = default(int);
var args = default(List<object>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<object>>();
});

AssertEx.Throws<NativeArgumentsParseException>(
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42 })),
() => module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42 })),
ex => Assert.AreEqual("jsArguments", ex.ParamName));
}

Expand All @@ -252,13 +252,13 @@ public void NativeModuleBase_Invocation_Promises_Reject()
var id = default(int);
var args = default(Dictionary<string, string>[]);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<Dictionary<string, string>[]>();
});

module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42, 43 }));
module.Methods[nameof(CallbackNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42, 43 }));
Assert.AreEqual(43, id);
Assert.AreEqual(1, args.Length);
var d = args[0];
Expand All @@ -277,13 +277,13 @@ public void NativeModuleBase_Invocation_Promises_NullCallback()
var id = default(int);
var args = default(List<object>);

var catalystInstance = new MockCatalystInstance((i, a) =>
var reactInstance = new MockReactInstance((i, a) =>
{
id = i;
args = a.ToObject<List<object>>();
});

module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(catalystInstance, JArray.FromObject(new[] { 42, 43 }));
module.Methods[nameof(PromiseNativeModule.Foo)].Invoke(reactInstance, JArray.FromObject(new[] { 42, 43 }));
Assert.AreEqual(1, args.Count);
Assert.IsNull(args[0]);
}
Expand All @@ -292,15 +292,15 @@ public void NativeModuleBase_Invocation_Promises_NullCallback()
public void NativeModuleBase_ReflectionDelegateFactory_Perf()
{
var module = new PerfNativeModule(ReflectionReactDelegateFactory.Instance);
var catalystInstance = new MockCatalystInstance();
var reactInstance = new MockReactInstance();
var args = JArray.FromObject(new[] { 42 });

module.Initialize();

var n = 100000;
for (var i = 0; i < n; ++i)
{
module.Methods[nameof(PerfNativeModule.Foo)].Invoke(catalystInstance, args);
module.Methods[nameof(PerfNativeModule.Foo)].Invoke(reactInstance, args);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
using Newtonsoft.Json.Linq;
using ReactNative.Bridge;
using ReactNative.Bridge.Queue;
using ReactNative.Hosting.Bridge;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace ReactNative.Tests.Hosting.Bridge
namespace ReactNative.Tests.Bridge
{
[TestClass]
public class ReactBridgeTests
Expand Down
9 changes: 0 additions & 9 deletions ReactWindows/ReactNative.Tests/Bridge/ReactContextTests.cs

This file was deleted.

Loading