-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`global element 1`] = ` | ||
"\\"use strict\\"; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\\"value\\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\\"Cannot call a class as a function\\"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\\"this hasn't been initialised - super() hasn't been called\\"); } return call && (typeof call === \\"object\\" || typeof call === \\"function\\") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== \\"function\\" && superClass !== null) { throw new TypeError(\\"Super expression must either be null or a function, not \\" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var Element = window.Element; | ||
var Foo = function (_React$Component) { | ||
_inherits(Foo, _React$Component); | ||
function Foo() { | ||
_classCallCheck(this, Foo); | ||
return _possibleConstructorReturn(this, (Foo.__proto__ || Object.getPrototypeOf(Foo)).apply(this, arguments)); | ||
} | ||
_createClass(Foo, [{ | ||
key: \\"render\\", | ||
value: function render() { | ||
return null; | ||
} | ||
}]); | ||
return Foo; | ||
}(React.Component); | ||
Foo.propTypes = { | ||
element: typeof Element === \\"function\\" ? require(\\"prop-types\\").instanceOf(Element).isRequired : require(\\"prop-types\\").any.isRequired | ||
};" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const babel = require('babel-core'); | ||
const content = ` | ||
const Element = window.Element; | ||
type FooProps = { | ||
element: Element, | ||
} | ||
class Foo extends React.Component { | ||
props: FooProps; | ||
render() { return null; } | ||
} | ||
`; | ||
|
||
it('global element', () => { | ||
const res = babel.transform(content, { | ||
babelrc: false, | ||
presets: ['es2015', 'stage-1', 'react'], | ||
plugins: ['syntax-flow', require('../')], | ||
}).code; | ||
expect(res).toMatchSnapshot(); | ||
}); |