Commit Graph

153 Commits

Author SHA1 Message Date
Jim 4a465fbd9a Make events propagate through shadow DOMs. 2015-07-02 04:32:22 -07:00
Ben Alpert c22153e25a Fail tests on any un-spied warnings
Fixes #3890.
2015-06-29 07:57:35 -07:00
Ben Alpert ffd527f593 DOM components as refs
Still missing: .props/.getDOMNode warnings.
2015-06-22 16:51:21 -07:00
Paul O’Shannessy a841b4f5fb Merge pull request #2981 from hzoo/jsdoc-fixes 2015-06-17 16:06:37 -07:00
Ben Alpert c265504fe2 Merge pull request #4152 from spicyj/rce
Disallow passing a DOM component to reactComponentExpect
2015-06-16 23:33:09 -07:00
Ben Alpert cf6b3ff0e2 Disallow passing a DOM component to reactComponentExpect
We won't be able to support this after DOM-components-as-refs but we don't expect many people to be passing DOM components to this function anyway, and it should be fairly straightforward for people to clean up failing unit tests using this function.

(This module also isn't public API and never has been.)
2015-06-16 17:51:06 -07:00
Ben Alpert 4070c4ca20 Disallow passing a DOM component to findAllInRenderedTree
We won't be able to support this after DOM-components-as-refs but we don't expect many people to be passing DOM components to this function anyway, and it should be fairly straightforward for people to clean up failing unit tests using this function.
2015-06-16 16:37:37 -07:00
Ben Alpert c9b0c26966 Invert logic in findAllInRenderedTreeInternal
With DOM components we won't be able to go from public instance to internal instance reliably, so do the traversal on internal instances.
2015-06-16 14:38:03 -07:00
yiminghe a5f3962ef6 update code style 2015-06-11 23:26:09 +08:00
yiminghe 69339a0f67 update code style 2015-06-11 23:21:52 +08:00
yiminghe e704503dc7 optimize className check 2015-06-10 01:11:39 +08:00
Ben Alpert bfcad9614a Warn when accessing .props, .setProps on DOM components 2015-06-08 10:36:20 -07:00
Paul O’Shannessy 2b195cb1ca Merge pull request #3941 from troutowicz/testing_type
Assert instance type using internal constructor
2015-06-04 13:31:23 -07:00
Ben Alpert 12ea09a03c Remove web worker test 2015-05-27 10:52:32 -07:00
Tim Routowicz f1e32a06e0 Assert instance type using internal constructor 2015-05-22 16:13:06 -04:00
Sławomir Laskowski 2c83627ca8 Add shallow context pass test 2015-05-21 00:08:31 +02:00
Ben Alpert 93a782b40b Use Babel to build React
Size comparison:

```
   raw     gz Compared to master @ 6ed98ec0c8
     =      = build/JSXTransformer.js
-15736  -3247 build/react-with-addons.js
  +287     +7 build/react-with-addons.min.js
-14412  -2887 build/react.js
  +274    +15 build/react.min.js
```

Differences mostly look to be various bits of whitespace that Babel ends up removing during its transforms (https://gist.github.com/spicyj/21ef31f4d95fb7a58daf). In minified files, mostly additions of `"use strict";`.
2015-05-04 14:14:09 -07:00
Henry Zhu 0937e918aa jsdoc fixes 2015-05-04 16:04:49 -04:00
Scott Feeney df937af91c Shallow render components that define contextTypes
You now no longer have to pass an undocumented extra argument to the
shallow renderer for rendering components with contextTypes to work.

Fixes #3696
2015-04-21 16:17:06 -07:00
Ben Alpert d8117d0df6 Merge pull request #1366 from spicyj/enterleave-testutils
Make Simulate.mouseEnter/Leave use direct dispatch
2015-04-13 15:39:54 -07:00
Ben Alpert 9260b540ad Merge pull request #3467 from spicyj/valid-3
Validate node nesting, take 3
2015-03-24 13:30:16 -07:00
Ben Alpert f9abf493b4 Validate node nesting, take 3
Nicer version of #644 and #735. Fixes #101. Context is neat.
2015-03-20 16:10:02 -07:00
Ben Alpert e791fccf58 Use console.error to show stack trace in console
Better version of #3277.

Test Plan: jest, grunt test
2015-03-17 13:39:04 -07:00
Paul O’Shannessy 10112672b1 Merge pull request #3395 from Simek/reactComponentExpect-cleanup
toBeDOMComponentWithChildCount readability
2015-03-16 16:14:48 -07:00
Paul O’Shannessy 99cbaed836 Ensure FullPageComponents are treated as DOM components
We currently override a couple DOM components. We need to ensure everything we
override is still treated as a DOM component, even if it has a composite
component wrapper.
2015-03-16 15:18:39 -07:00
Ben Alpert 0a312bba89 Merge pull request #3414 from spicyj/gh-3407
Fix up Perf a bit better for 0.13
2015-03-16 14:04:28 -07:00
Ben Alpert 98671fda1a Fix up Perf a bit better for 0.13
_mountImageIntoNode moved into ReactMount and wasn't being counted where it was supposed to be. In addition, all DOM elements are now wrapped in a composite wrapper but for the perf tools we want to skip over those or else we'll double-count (at least with the current accounting -- and that's effectively what we did before so this brings us back up to parity).

Fixes #3407.

Test Plan:
Used the jsbin from #3407 and saw similar output from this branch and 0.12:

![image](https://cloud.githubusercontent.com/assets/6820/6649816/4d7202e0-c9b2-11e4-9364-e1b50c96b55b.png)
2015-03-13 18:51:53 -07:00
Ben Alpert 70985ba68d Squash getDOMNode warning from isDOMComponent
Fixes #3329.
2015-03-13 17:11:02 -07:00
Bartosz Kaszubowski 4b1d7bcec2 toBeDOMComponentWithChildCount readability 2015-03-13 00:15:32 +01:00
cpojer ae7da3aadd foo.getDOMNode => React.findDOMNode(foo) 2015-03-10 17:17:21 -07:00
Toru Kobayashi 29506cec54 Fix Perf displayName with ES6 classes 2015-03-10 09:45:40 +09:00
Christoph Pojer 8ce9e2b194 Update reactComponentExpect.js 2015-03-06 02:46:33 -08:00
Ben Alpert feae9ad0a8 Add regression test for scry order
Fixes #2978.
2015-02-26 15:54:50 -08:00
yungsters e9e33b984f Support unmounting in ReactShallowRenderer
Reviewers: @sebmarkbage, @zpao

Test Plan:

```
$ npm test ReactTestUtils
```
2015-02-18 17:45:42 -08:00
yungsters e952869ff8 Support rendering to null in ShallowComponentRenderer
Reviewers: @sema, @zpao

Test Plan:
```
$ npm jest
```
2015-02-18 11:31:02 -08:00
Ben Alpert 6b03975395 Make Simulate.mouseEnter/Leave use direct dispatch
Fixes #1297.

onMouseEnter and onMouseLeave shouldn't *actually* use direct dispatch, but doing so is more useful than doing nothing (and I don't think it precludes adding proper enter/leave dispatching later, either).

Test Plan:
grunt test
2015-02-16 16:12:19 -08:00
Henry Zhu cb49492f88 lint whitespace
- use spaces
- remove space before paren in function
-  remove space before colon in object
2015-02-14 11:12:18 -05:00
Henry Zhu e2a57920da lint whitespace , trailing comma 2015-02-13 23:13:47 -05:00
Rick Beerendonk 3e0750a4ad Update copyright headers for 2015 2015-01-31 20:18:25 +01: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 Markbage 766a79c695 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-23 10:09:45 -08:00
Isaac Salier-Hellendag de54d84051 Repair ReactDefaultPerf
Update ReactDefaultPerf to properly record component names.
2015-01-21 10:52:43 -06:00
Paul O’Shannessy 967435b249 Revert "Merge pull request #2814 from jsfb/testutils-consolemock"
This reverts commit 9514861d93, reversing
changes made to cdec83732d.
2015-01-15 13:35:57 -08:00
Paul O’Shannessy df64a67b7f codemod "use strict" to 'use strict' for better linting 2015-01-13 15:26:32 -08:00
Jim bd4aff062d Added jasmine matcher that expects calls to console.warn. 2015-01-06 14:05:37 -08:00
Paul O’Shannessy 63d8e0c144 Fix lint 2014-12-14 15:22:24 -08:00
Paul O’Shannessy c9fb5b258e Add toBeTextComponentWithValue to reactComponentExpect
This was previously possible by looking at renderedChildren and props
but this feels better.
2014-12-14 14:12:29 -08:00
Jim 74f5b21758 Fixed ReactTestUtils scry for TextComponents. Fixes issue #2654. 2014-12-11 13:12:35 -08:00
Paul O’Shannessy 739baa9092 Fix new lint errors
We'll get to lint parity soon and then not need to do this.
2014-12-08 12:18:41 -08:00
Paul O’Shannessy c48b877253 Merge pull request #2596 from sebmarkbage/rce
reactComponentExpect expects itself
2014-11-26 11:10:00 -08:00