Commit Graph

3514 Commits

Author SHA1 Message Date
Paul O’Shannessy
bab59cd090 Pull in 0.13 beta blog post from 0.12-stable branch 2015-01-30 11:49:40 -08:00
Paul O’Shannessy
5bd078508a v0.13.0-beta.1 2015-01-27 21:13:35 -08:00
Paul O’Shannessy
bd56b731de Merge pull request #2967 from zpao/jest-match-internal
[jest] Use persistModuleRegistryBetweenSpecs
2015-01-27 20:54:19 -08:00
Paul O’Shannessy
657e30771a Merge pull request #2966 from zpao/grunt-jest
Run jest with grunt, add to travis
2015-01-27 20:51:39 -08:00
Paul O’Shannessy
e2d3370aa9 Merge pull request #2964 from zertosh/no-derequire-when-minifying
Remove "derequire" from minified bundles
2015-01-27 20:51:08 -08:00
Paul O’Shannessy
14d88d4e38 [jest] Use persistModuleRegistryBetweenSpecs
This more closely matches how we have jest configured at FB, so when we
pull in and run internally we will have fewer things to waste time on.
2015-01-27 19:17:31 -08:00
Paul O’Shannessy
49eb84efdd Run jest with grunt, add to travis
This is to make sure we don't end up with differences in our different
testing methods. We may switch out the failure allowances later (maybe
just jest will be good enough and we can let phantom fail for a little
bit).
2015-01-27 18:04:58 -08:00
Paul O’Shannessy
dbdeb078ce [testing] dump the cache when depending on warning messages
It's possible to configure Jest to not dump the module cache between
specs. This makes it tricky when we silence warnings one a 2nd call.

In this case, the same message was getting logged so when we expected
the count of warning calls to increment, it didn't.
2015-01-27 16:02:00 -08:00
Jim
2ea1f51fe8 Merge pull request #2965 from ClimbsRocks/patch-4
Docs wording tweak: subject verb agreement
2015-01-27 14:45:15 -08:00
Preston Parry
e4352efc21 Update 04-multiple-components.md 2015-01-27 14:34:35 -08:00
Andres Suarez
5c5fc5e316 Remove "derequire" from minified bundles 2015-01-27 16:53:18 -05:00
Paul O’Shannessy
9801f2d8ab Merge pull request #2940 from kevinold/2749-consistent-use-of-spys-or-mocks
update to use spyOn for console.warn #2749
2015-01-27 13:38:56 -08:00
Ben Alpert
513433b370 Merge pull request #2962 from ClimbsRocks/patch-3
Docs wording tweak for clarity
2015-01-27 11:59:00 -08:00
Ben Alpert
8174262135 Merge pull request #2961 from ClimbsRocks/patch-1
Rewording for clarity
2015-01-27 11:58:36 -08:00
Preston Parry
33ecec07cb Update 02.1-jsx-in-depth.md 2015-01-27 11:22:21 -08:00
Preston Parry
cadbe1d27e Rewording for clarity 2015-01-27 11:04:21 -08:00
Sebastian Markbåge
8bbaa95a49 Merge pull request #2948 from jergason/master
do not validate propTypes in production
2015-01-27 10:55:14 -08:00
Sebastian Markbåge
61c4497d58 Merge pull request #2959 from sebmarkbage/createmixin
We don't currently have a way to trace the origin of a mixin
2015-01-27 10:39:25 -08:00
Sebastian Markbåge
b3f96d97f9 Merge pull request #2957 from sebmarkbage/renamecomponent
Rename ReactComponentBase -> ReactComponent
2015-01-27 10:39:07 -08:00
Sebastian Markbage
295ef0063b We don't currently have a way to trace the origin of a mixin
This makes it more difficult to find bugs in mixins both dynamically
and using a static type system.

We also don't have a way to find these to be upgraded to a new mixin
syntax if we needed to.

This hook is currently an optional noop but could be made required to
create a mixin class.
2015-01-27 09:36:14 -08:00
Sebastian Markbage
c3c98084b9 Rename ReactComponentBase -> ReactComponent
We freed up this internal name by removing the internal base class.
We're now free to use this name as it was intended.

ReactDOMComponent and ReactCompositeComponent are still confusing as
they're internal but we'll rename them later.
2015-01-27 09:22:07 -08:00
Jamison Dance
f61ca8d307 don't validate propTypes in production
Switch to warnings so code execution doesn't differ between prod and
dev.
2015-01-27 09:45:20 -07:00
Sebastian Markbåge
16a56afada Merge pull request #2936 from sebmarkbage/refactorlifecycles
Use Singleton LifeCycle State
2015-01-27 01:26:30 -08:00
Sebastian Markbage
bebc568ceb Use Singleton LifeCycle State
All entry points are for reconciliation are within batching strategies.

Since we don't have any batching strategies with synchronous updates,
there can't be more than one life-cycle method on the stack at any given
time.

Therefore, it's safe to move the composite life cycle flag to a singleton.
This saves us some memory management.

I think that we can get rid of these life cycle states completely in the
future.
2015-01-27 01:19:31 -08:00
Sebastian Markbåge
7e6251887f Merge pull request #2935 from sebmarkbage/batchupdates
Batch updates in initial render
2015-01-27 01:06:56 -08:00
Sebastian Markbage
9811b10aaa Batch updates in initial render
Currently, the first setState that happens during initial render will
start a new batch. Any subsequent updates will be batched. That means that
the first setState is synchronous but any subsequent setStates are
asynchronous.

This commit makes it so that the batching starts at the root. That way all
the setStates that happen within life-cycle methods are asynchronous.
2015-01-27 01:00:59 -08:00
Sebastian Markbåge
b3df7cabb7 Merge pull request #2930 from sebmarkbage/updatequeue
Extract setState, setProps etc into ReactUpdateQueue
2015-01-27 00:57:44 -08:00
Sebastian Markbage
ed7332c749 Extract setState, setProps etc into ReactUpdateQueue
I originally did this work so that we could allow setState to be called
before the internal ReactCompositeComponent was constructed. It's unlikely
that we'll go down that route now but this still seems like a better
abstraction. It communicates that this is not immediately updating an
object oriented class. It's just a queue which a minor optimization.
It also avoids bloating the ReactCompositeComponent file.

Since they both depend on the life cycle I break that out into a common
shared dependency. In a follow up I'll refactor the life-cycle management.
2015-01-27 00:55:25 -08:00
Sebastian Markbage
103bf101ae Fix broken jest test
jest accidentally picked up this .d.ts file as a test.

I'll just move it out to fix it.
2015-01-26 23:37:30 -08:00
Sebastian Markbåge
9b23807cfd Merge pull request #2953 from sebmarkbage/callbacktests
Add Tests to Callbacks of the Life Cycles
2015-01-26 23:30:14 -08:00
Sebastian Markbage
fd077d7492 Add Tests to Callbacks of the Life Cycles
This adds some much needed tests of the callbacks to setState, setProps
and render.
2015-01-26 23:26:24 -08:00
Jim
61ee74b562 Merge pull request #2941 from kevinold/2870-update-warning-calls
Update warning calls to use %s #2870
2015-01-26 22:06:42 -08:00
Kevin Old
f0ea2b5979 update to use spyOn for console.warn #2749 2015-01-26 21:51:42 -06:00
Kevin Old
e8ef06783a Update warning calls to use %s #2870 2015-01-26 21:39:43 -06:00
Paul O’Shannessy
c6d1904f24 Merge pull request #2951 from mzabriskie/semicolon
Provide warning when using styles containing a semicolon
2015-01-26 18:32:57 -08:00
Jim
c3522b80a5 Merge pull request #2920 from jsfb/move-proptype-validation
Move propType validation to element instead of class.
2015-01-26 17:21:01 -08:00
Sebastian Markbåge
46ae2f4e55 Merge pull request #2952 from sebmarkbage/typescript
Add Basic TypeScript Class Test
2015-01-26 17:19:18 -08:00
Jim
6ee5299b4a Move propType validation to element instead of class.
Conflicts:
	src/classic/element/ReactElementValidator.js
2015-01-26 17:16:49 -08:00
Sebastian Markbage
f837cc289e Move component class instantiation into ReactCompositeComponent
We need to move instantiation into the mount phase for context purposes.

To do this I moved the shallow rendering stuff into ReactTestUtils and
reused more of the existing code for it by instantiating a noop child.

Everywhere we refer to the "type" we should pass it to ReactNativeComponent
to resolve any string value into the underlying composite.
2015-01-26 17:16:21 -08:00
mzabriskie
ae5a124745 Using %s in warning message 2015-01-26 18:09:21 -07:00
mzabriskie
fca0fdc115 Better tests 2015-01-26 18:08:51 -07:00
Sebastian Markbage
6c145c31f5 Add Basic TypeScript Class Test
As part of the new class effort it is now possible to define React
Components using any type of generic JavaScript class syntax.

This includes TypeScript classes. This test ensures that we don't regress
that support, and also serves as an example for using React in TypeScript.
TypeScript provides a good demo of where we think property initializers
are going.

We don't have any official *type* support for TypeScript yet.

This test trails the ReactES6Class-test file. Some manual tweaking is
required when converting tests.
2015-01-26 16:59:11 -08:00
mzabriskie
b6edbae3fc Renaming assertValidStyle to warnValidStyle 2015-01-26 17:50:35 -07:00
mzabriskie
94fb463c06 Moar tests 2015-01-26 17:45:51 -07:00
mzabriskie
05e2bc6b5c Fixing lint failures 2015-01-26 17:41:54 -07:00
mzabriskie
4054bb13cd Provide warning when using styles containing a semicolon 2015-01-26 17:33:44 -07:00
Paul O’Shannessy
96058a10ee Merge pull request #2939 from patlaughlin/patch-1
Update 06-transferring-props.md
2015-01-26 16:32:09 -08:00
Sebastian Markbåge
d750cf7401 Merge pull request #2942 from sebmarkbage/metamatchers
Add Meta Matchers for Testing Tests
2015-01-26 16:05:40 -08:00
Sebastian Markbage
3bbf6ce1a5 Add Meta Matchers for Testing Tests
This adds a matcher called toEqualSpecsIn which executes two test suites,
without reporting the result. It then compares the specs and the number
of expects executed by each spec.

This will be used to ensure that tests written in other languages test the
same thing as the base line, ES6 classes.

Sets up CoffeeScript equivalence test.
2015-01-26 15:50:57 -08:00
Sebastian Markbåge
e6672a3a03 Merge pull request #2944 from sebmarkbage/coffeescript
Add CoffeeScript Class Test
2015-01-26 11:10:18 -08:00