The keys are names of the properties, which is more natural in JS, but will cause issues with ability to create objects where arrays of values. This feature will be removed in a subsequent commit.
* sk-project-cleanup:
Fix for failing React tests
Rename JS test files to be consistent
Cleanup and fix resolving JS test files
Cleanup source groups in Xcode project
Move RealmJS.mm to correct location
The Results class was updated to match the style of List and include a flag (m_live) that determines if it should sync updates. If an object in the static Results is deleted, then it will return null.
Since the JS test modules have been renamed to have consistent naming, we add a method to actually run the test methods to use our existing abstraction.
The top-level package.json explicitly includes the directories it needs (vendor/.npmignore cuts down the cruft). The publish-beta.sh script essentially uses `npm pack` to package up the NPM module and then push it into an orphaned `beta` branch.
The target dependencies are discovered implicitly, and removing the use of explicitly defined dependencies actually resolved a very odd bug with Xcode when building ReactExample.app for a device.
Specifically for objects with lists, since the mutation listener would fire on a list that no longer is attached. If during the mutation listener that error is thrown, then the listener will be removed and the error will not be propagated.
Previously we were not accounting for the byte offsets and misunderstood how the Uint8Array constructor worked. The tests now confirm everything works as expected with multiple different typed arrays and slices of the data.
As a convenience, the setters will take typed Arrays (e.g. Uint8Array) since that is a common representation of data in JS (as they are "views" of ArrayBuffer objects).
The tests have been updated to reflect this new behavior.
This module has build errors with Release configuration and is not necessary. When in Chrome debugging mode, a warning will be issued about missing the RCTSnapshot module though, which is why we linked against it in the first place.
* sk-chrome-xcode-tests:
Actually report test failures when running in Chrome
Change RealmReactTests to run with both executors
Fix RealmReactTests to work through Chrome
Use a default to override Chrome debugging setting
Change ReactTests project to 4 space indentation
A new approach was needed for this. The RCTDevMenu is disabled so that it doesn't interfere with us changing the executor class. A suffix is added to the name of test cases that are run in Chrome.
The key idea was the cycle the runloop once after receiving the RCTJavaScriptDidLoadNotification so that the RCTDevMenu could also handle that notification and setup the bridge properly, as well as not block the main thread by spinning the runloop instead.
This is done in a way that does not override the persistent user defaults. You set this default when launching the app by supplying `-RealmReactEnableChromeDebugging YES/NO` launch arguments.
Rather than using Object.preventExtensions to throw exceptions when setting any out-of-bounds index, we must instead compromise by only throwing for the common cases, which are -1 and list.length. Having Object.keys() support is essential for List to work with React Native ListViewDataSource.
Resolves#80
This also appears to fix crashes when running ReactTests with Chrome debugging enabled!
The crash when tests failed was due to JavaScriptCore trying to create a backtrace with the native call stack.
The test structure is now provided by a JS API, that is used by all things that run tests. Also, the tests can be run manually by tapping a button in the ReactTests app.
The deleteTestFiles() function is now added to the Realm object, so that it's easy for the RPC module to handle this as well. We can only do this in testing environments in the future.
* sk-react-framework: (27 commits)
Change RealmReact to be a dynamic framework
finish Array to List rename
RJSArray -> RJSList
move property getters to object store code
move List class to its own file
ObjectArray -> List
Add Notification constructor and destructor
Small improvement to notifications test
RJSException no longer requires JS strings
Protect realm and callback from GC in addNotification
Add comments
pr fixes
minimal tests for migrations
Check for NaN inside RJSValidatedValueToNumber
allow running all tests at the same path by invalidating all cached realm paths between test runs
Native methods should convert to numbers/bools
Out of bounds getters for Results return undefined
Out of bounds list item getters return undefined
Consolidate code that verifies array index bounds
Add list item setters in JS
...
It embeds RealmJS and GCDWebServers frameworks. This fixes#58, where there were issues with building for devices rather than just the simulator.
Some changes were made so that RealmReact.m didn't need to be weakly linked to libReact.a since that would actually cause any executable that uses this framework from being able to compile with bitcode.
Turns out this API can return NaN without an exception. Also added tests to make sure these conversions either work or throw exceptions in the appropriate places.