Commit Graph

30 Commits

Author SHA1 Message Date
Thomas Aylott 8205c681eb serve worker.js from its actual relative path 2013-11-06 15:30:49 -05:00
Paul O'Shannessy 46713c3d7d Fix Lint
Enabling bitwise linting caught another user. Also fixed a semicolon
misuse.
2013-10-15 17:59:14 -07:00
Jan Kassens c99d6a8013 Make the injection of ReactPerf work
The injection was only evaluated when ReactCompositeComponent was first loaded.
This made it impossible to inject a custom measure and the injection pointless.
2013-10-09 11:27:40 -07:00
Ben Newman f8c5752472 Merge pull request #374 from spicyj/workers
Test that React loads properly in a web worker.

Most of this code is open source-only, so I think it's safe to merge without figuring out how to translate it upstream first.
2013-10-09 08:50:41 -07:00
Paul O'Shannessy f43449d333 ReactNativeComponent -> ReactDOMComponent
In an effort to break the DOMy parts of React away from the non-DOMy parts, I'm renaming this.
2013-10-01 16:31:32 -07:00
Ben Alpert 3dc1074908 Test that React loads properly in a web worker
This should catch top-level uses of `window` and `document`, while lint rules catch `global`.
2013-09-27 14:38:11 -07:00
Timothy Yung aa765e8fa3 Merge pull request #287 from spicyj/noglobal
Remove all uses of ExecutionEnvironment.global
2013-09-09 16:23:20 -07:00
Ben Alpert 426cdbb3ae Remove all uses of ExecutionEnvironment.global
Closes #271.

All three of these files are DOM-specific so it should be fine to use window. (ReactEventTopLevelCallback isn't obviously DOM-specific but it calls getEventTarget which is so I think we're fine here.)

Test Plan:
grunt test, tried events in a real browser and they seemed to work still.
2013-09-09 15:51:06 -07:00
Pete Hunt c8886a0424 Make mounting on the root of the page work correctly
This was apparently only partially supported. We had issues initially mounting if there was no HTML present and
also had issues if we had to update HTML that was already there. This diff fixes all of these cases and has
tests to prove it. NOTE: I removed a test that was actually erroneous. My bad.
2013-09-05 13:50:18 -07:00
Pete Hunt c41e86c990 Make ReactDefaultPerf work server-side
We were reading from window which was throwing when ReactDefaultPerf was injected.
2013-08-30 13:20:53 -07:00
Danny Ben-David fce57abeca Benchmarking tool for React application performance
ReactAppPerf wraps core methods and logs info from them; there's no real
UI at this point
2013-08-23 14:05:11 -07:00
Jordan Walke 2ee66262db Remove circular dependencies in React Core.
There is a circular dependency between `ReactID`, `ReactMount` and
`ReactInstanceHandles`. Ben and I talked about this today. It seems like the
simplest solution is to consolidate a lot of the code that Ben recently wrote
into `ReactMount`. We can later find ways to trim code out of this module
without causing circular deps.
2013-07-24 17:40:57 -07:00
Ben Newman 0441d4c7f5 Rename removeSiblings to removeNextSiblings. 2013-07-19 14:18:44 -04:00
Ben Newman 36fbd8d941 After each test, remove any stray nodes added to the document.
This was not necessary when we were running each test in its own
`<iframe>`, and it doesn't seem to affect any test behavior currently, but
it seems wise for the sake of test isolation and hygiene.
2013-07-19 13:53:15 -04:00
Ben Newman 507e58ed96 Pull in my rewritten Function.prototype.bind polyfill from upstream.
We don't sync upstream polyfills (because we don't have a story for how
they would be used), so this needs to be updated manually.

Sacrificed some negligible performance optimizations to reduce the number
of different cases from four to one.

It's important to test this implementation in PhantomJS, since that's the
only browser that I know of where built-in functions sometimes do not have
a `.prototype`.
2013-07-19 12:28:44 -04:00
Ben Newman 5beb481145 Abandon <iframe> test isolation hack now that we have dumpCache.
This cuts the running time of `grunt phantom:run` from 4.4s to 3.1s on my
machine, because we no longer have to load/execute a separate instance of
`react-test.js` in a separate `<iframe>` for each test.
2013-07-19 11:10:02 -04:00
Ben Newman 2d61639f90 Store dirtyMocks array globally so it can survive dumpCache().
When require("mock-modules").dumpCache() is called, all mock functions
previously created continue to refer to the old dirtyMocks array.

If we replace that array with a new one, those mock functions will never
have their .mockClear() methods called again.

The upstream version of mocks.js pulls a similar global trick, and I never
understood why until now.
2013-07-15 19:41:40 -04:00
Ben Newman 204796868d Enable module.exports mocking in react-test.js.
We don't currently attempt to mock modules automatically, but we do
respect require("mock-modules").mock, .dontMock, and .dumpCache.

I'm going to keep investigating auto-mocking, since that would move us
much closer to the behavior used within Facebook.

Closes #154.
Closes #155.
2013-07-15 19:41:40 -04:00
Ben Newman 37014e1002 Call require("mock-modules").register in every mockable module.
Mocking happens only when config.constants.__MOCK__ is true.
2013-07-15 18:10:49 -04:00
Ben Newman c6c4657f83 Use populist v0.1.2 to bundle test modules instead of browserify.
This will allow full support for mocking, dumpCache, and correct line
numbers in error messages.
2013-07-15 18:10:49 -04:00
CommitSyncScript 3373572e15 Use ReactID.{get,set}ID instead of manipulating .id property directly.
Another step in the plan to centralize control of React-specific identifers.
2013-06-21 16:08:07 -07:00
CommitSyncScript 1839bcf109 Replace uses of ReactDOMNodeCache and getDOMNodeID with ReactID.
Also removed some unnecessary calls to `document.getElementById`, which
will eventually cease to work for React-specific IDs.

This clears the way for the deprecation of `ReactDOMNodeCache` and
`getDOMNodeID`.
2013-06-21 16:07:51 -07:00
CommitSyncScript 36a724feca Add reactComponentExpect#toBeComponentOfType
This adds a `toBeComponentOfType` method to `reactComponentExpect`. Now that we are injecting composite native components, `toBeDOMComponentWithTag` will not suffice and should be deprecated.
2013-06-21 16:02:55 -07:00
CommitSyncScript 88e90d5601 Use Synthetic Events
Swaps out usage of `AbstractEvent` with `SyntheticEvent` (and subclasses).
2013-06-17 12:49:45 -07:00
CommitSyncScript 9d1055b3d2 Rename ReactEvent to ReactEventEmitter
ReactEvent should be reserved for the actual object created when an
event fires. The current ReactEvent is more like EventEmitter than
anything (e.g. it sets up delegation, provides methods to attach and
remove listeners).
2013-06-06 14:29:45 -07:00
CommitSyncScript 0614d30654 Move test utils internally, update for consistency 2013-06-06 14:29:44 -07:00
Ben Newman 603c9ef6a8 Implement constructor-aware binding per @zpao's request.
When the function to be bound does not have a prototype, ignore the constructor case.
2013-06-03 13:20:13 -04:00
Ben Newman 03f92bb155 Polyfill Function.prototype.bind during tests. 2013-06-03 13:20:13 -04:00
Ben Newman f8af93237a Use bin/jsx and browserify to build a jasmine bundle. 2013-06-03 13:20:13 -04:00
Paul O’Shannessy 75897c2dcd Initial public release 2013-05-29 12:54:02 -07:00