lanes 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/client/lanes/Config.coffee +1 -1
  4. data/client/lanes/access/LoginDialog.cjsx +1 -1
  5. data/client/lanes/access/Roles.coffee +1 -1
  6. data/client/lanes/access/User.coffee +2 -2
  7. data/client/lanes/access/screens/user-management/UserManagement.cjsx +1 -1
  8. data/client/lanes/components/calendar/styles.scss +1 -1
  9. data/client/lanes/components/grid/Body.cjsx +5 -2
  10. data/client/lanes/components/grid/EditingMixin.cjsx +3 -0
  11. data/client/lanes/components/grid/Editor.cjsx +3 -11
  12. data/client/lanes/components/grid/Grid.cjsx +22 -12
  13. data/client/lanes/components/grid/Selections.cjsx +4 -1
  14. data/client/lanes/components/grid/Toolbar.cjsx +1 -1
  15. data/client/lanes/components/record-finder/RecordFinder.cjsx +2 -2
  16. data/client/lanes/components/select-field/SelectField.cjsx +19 -16
  17. data/client/lanes/components/select-field/styles.scss +1 -1
  18. data/client/lanes/components/shared/FieldMixin.cjsx +2 -2
  19. data/client/lanes/components/shared/Input.cjsx +2 -13
  20. data/client/lanes/components/shared/InputFieldMixin.cjsx +15 -8
  21. data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +1 -1
  22. data/client/lanes/components/shared/NumberInput.cjsx +4 -12
  23. data/client/lanes/components/shared/ToggleField.cjsx +0 -2
  24. data/client/lanes/components/shared/fields.scss +9 -0
  25. data/client/lanes/components/shared/styles.scss +2 -1
  26. data/client/lanes/components/toolbar/Toolbar.cjsx +1 -1
  27. data/client/lanes/lib/HotReload.coffee +2 -2
  28. data/client/lanes/lib/development.coffee +1 -1
  29. data/client/lanes/lib/loader.coffee +3 -3
  30. data/client/lanes/models/AssociationMap.coffee +1 -1
  31. data/client/lanes/models/AssociationProxy.coffee +1 -0
  32. data/client/lanes/models/Base.coffee +7 -10
  33. data/client/lanes/models/Collection.coffee +3 -6
  34. data/client/lanes/models/JobStatus.coffee +1 -1
  35. data/client/lanes/models/PubSub.coffee +51 -33
  36. data/client/lanes/models/Query.coffee +1 -1
  37. data/client/lanes/models/Sync.coffee +1 -1
  38. data/client/lanes/models/User.coffee +3 -3
  39. data/client/lanes/models/mixins/FileSupport.coffee +3 -3
  40. data/client/lanes/models/query/ArrayResult.coffee +3 -6
  41. data/client/lanes/models/query/CollectionResult.coffee +5 -3
  42. data/client/lanes/react/Component.coffee +2 -2
  43. data/client/lanes/react/DefaultComponentNotFound.cjsx +2 -2
  44. data/client/lanes/react/Screen.coffee +1 -1
  45. data/client/lanes/react/Viewport.coffee +1 -1
  46. data/client/lanes/react/mixins/Access.coffee +1 -1
  47. data/client/lanes/react/mixins/Data.coffee +9 -5
  48. data/client/lanes/screens/Commands.coffee +1 -1
  49. data/client/lanes/screens/UserPreferences.cjsx +1 -1
  50. data/client/lanes/testing/BeforeEach.coffee +7 -0
  51. data/client/lanes/vendor/base.js.erb +5 -0
  52. data/client/lanes/vendor/calendar.js.erb +5 -0
  53. data/client/lanes/vendor/commons.js.erb +5 -0
  54. data/client/lanes/vendor/{base.js → development/base.js} +37776 -40850
  55. data/client/lanes/vendor/development/calendar.js +1667 -0
  56. data/client/lanes/vendor/development/commons.js +39085 -0
  57. data/client/lanes/vendor/development/helpers.js +578 -0
  58. data/client/lanes/vendor/{toggle.js → development/toggle.js} +22 -82
  59. data/client/lanes/vendor/development/widgets.js +8975 -0
  60. data/client/lanes/vendor/production/base.js +63239 -0
  61. data/client/lanes/vendor/production/calendar.js +1667 -0
  62. data/client/lanes/vendor/production/commons.js +38505 -0
  63. data/client/lanes/vendor/production/toggle.js +285 -0
  64. data/client/lanes/vendor/production/widgets.js +8975 -0
  65. data/client/lanes/vendor/{calendar.scss → styles/calendar.scss} +6 -0
  66. data/client/lanes/vendor/{toggle.scss → styles/toggle.scss} +0 -0
  67. data/client/lanes/vendor/{widgets.scss → styles/widgets.scss} +2 -2
  68. data/client/lanes/vendor/toggle.js.erb +5 -0
  69. data/client/lanes/vendor/widgets.js.erb +5 -0
  70. data/lib/lanes/api/default_routes.rb +3 -3
  71. data/lib/lanes/api/routing.rb +1 -1
  72. data/lib/lanes/configuration.rb +8 -14
  73. data/lib/lanes/environment.rb +3 -0
  74. data/lib/lanes/extension/definition.rb +4 -0
  75. data/lib/lanes/system_settings.rb +21 -6
  76. data/lib/lanes/version.rb +1 -1
  77. data/npm-build/base.js +9 -4
  78. data/npm-build/build +9 -0
  79. data/npm-build/development.js +3 -1
  80. data/npm-build/package.json +34 -34
  81. data/npm-build/update-dayz +1 -1
  82. data/npm-build/webpack.config.js +36 -20
  83. data/spec/command-reference-files/initial/Gemfile +1 -1
  84. data/spec/command-reference-files/screen/config/screens.rb +1 -1
  85. data/spec/lanes/components/grid/RowEditorSpec.coffee +3 -1
  86. data/spec/lanes/components/select-field/SelectFieldSpec.coffee +33 -28
  87. data/spec/lanes/models/AssociationProxySpec.coffee +36 -37
  88. data/spec/lanes/models/BaseSpec.coffee +0 -32
  89. data/spec/lanes/models/CollectionSpec.coffee +0 -10
  90. data/spec/lanes/models/PubSubSpec.coffee +63 -13
  91. data/spec/lanes/screens/DefinitionsSpec.coffee +2 -2
  92. metadata +23 -20
  93. data/client/lanes/vendor/calendar.js +0 -17301
  94. data/client/lanes/vendor/commons.js +0 -19722
  95. data/client/lanes/vendor/development.js +0 -5471
  96. data/client/lanes/vendor/grid.js +0 -15384
  97. data/client/lanes/vendor/grid.scss +0 -928
  98. data/client/lanes/vendor/rw-widgets.eot +0 -0
  99. data/client/lanes/vendor/rw-widgets.svg +0 -18
  100. data/client/lanes/vendor/rw-widgets.ttf +0 -0
  101. data/client/lanes/vendor/rw-widgets.woff +0 -0
  102. data/client/lanes/vendor/widgets.js +0 -23204
  103. data/npm-build/compile.coffee +0 -19
  104. data/spec/lanes/models/ServerCacheSpec.coffee +0 -65
@@ -0,0 +1,578 @@
1
+ webpackJsonp([2],{
2
+
3
+ /***/ 0:
4
+ /***/ function(module, exports, __webpack_require__) {
5
+
6
+ /* WEBPACK VAR INJECTION */(function(global) {var Lanes = ( global.Lanes || (global.Lanes = {}) );
7
+ Lanes.Vendor = ( Lanes.Vendor || {} );
8
+
9
+ // "react-proxy": "git@github.com:gaearon/react-proxy.git#react-0.15",
10
+ // Lanes.Vendor.ReactProxy = require("react-proxy");
11
+
12
+ Lanes.Vendor.ReactTestUtils = __webpack_require__(926);
13
+ Lanes.Vendor.deepForceUpdate = __webpack_require__(928);
14
+
15
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
16
+
17
+ /***/ },
18
+
19
+ /***/ 926:
20
+ /***/ function(module, exports, __webpack_require__) {
21
+
22
+ module.exports = __webpack_require__(927);
23
+
24
+ /***/ },
25
+
26
+ /***/ 927:
27
+ /***/ function(module, exports, __webpack_require__) {
28
+
29
+ /**
30
+ * Copyright 2013-present, Facebook, Inc.
31
+ * All rights reserved.
32
+ *
33
+ * This source code is licensed under the BSD-style license found in the
34
+ * LICENSE file in the root directory of this source tree. An additional grant
35
+ * of patent rights can be found in the PATENTS file in the same directory.
36
+ *
37
+ * @providesModule ReactTestUtils
38
+ */
39
+
40
+ 'use strict';
41
+
42
+ var _assign = __webpack_require__(68);
43
+
44
+ var EventConstants = __webpack_require__(103);
45
+ var EventPluginHub = __webpack_require__(105);
46
+ var EventPluginRegistry = __webpack_require__(106);
47
+ var EventPropagators = __webpack_require__(104);
48
+ var React = __webpack_require__(67);
49
+ var ReactDefaultInjection = __webpack_require__(101);
50
+ var ReactDOM = __webpack_require__(97);
51
+ var ReactDOMComponentTree = __webpack_require__(98);
52
+ var ReactElement = __webpack_require__(72);
53
+ var ReactBrowserEventEmitter = __webpack_require__(166);
54
+ var ReactCompositeComponent = __webpack_require__(179);
55
+ var ReactInstanceMap = __webpack_require__(180);
56
+ var ReactUpdates = __webpack_require__(118);
57
+ var SyntheticEvent = __webpack_require__(115);
58
+
59
+ var emptyObject = __webpack_require__(84);
60
+ var findDOMNode = __webpack_require__(227);
61
+ var invariant = __webpack_require__(71);
62
+
63
+ var topLevelTypes = EventConstants.topLevelTypes;
64
+
65
+ function Event(suffix) {}
66
+
67
+ /**
68
+ * @class ReactTestUtils
69
+ */
70
+
71
+ function findAllInRenderedTreeInternal(inst, test) {
72
+ if (!inst || !inst.getPublicInstance) {
73
+ return [];
74
+ }
75
+ var publicInst = inst.getPublicInstance();
76
+ var ret = test(publicInst) ? [publicInst] : [];
77
+ var currentElement = inst._currentElement;
78
+ if (ReactTestUtils.isDOMComponent(publicInst)) {
79
+ var renderedChildren = inst._renderedChildren;
80
+ var key;
81
+ for (key in renderedChildren) {
82
+ if (!renderedChildren.hasOwnProperty(key)) {
83
+ continue;
84
+ }
85
+ ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
86
+ }
87
+ } else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
88
+ ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
89
+ }
90
+ return ret;
91
+ }
92
+
93
+ /**
94
+ * Todo: Support the entire DOM.scry query syntax. For now, these simple
95
+ * utilities will suffice for testing purposes.
96
+ * @lends ReactTestUtils
97
+ */
98
+ var ReactTestUtils = {
99
+ renderIntoDocument: function (instance) {
100
+ var div = document.createElement('div');
101
+ // None of our tests actually require attaching the container to the
102
+ // DOM, and doing so creates a mess that we rely on test isolation to
103
+ // clean up, so we're going to stop honoring the name of this method
104
+ // (and probably rename it eventually) if no problems arise.
105
+ // document.documentElement.appendChild(div);
106
+ return ReactDOM.render(instance, div);
107
+ },
108
+
109
+ isElement: function (element) {
110
+ return ReactElement.isValidElement(element);
111
+ },
112
+
113
+ isElementOfType: function (inst, convenienceConstructor) {
114
+ return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
115
+ },
116
+
117
+ isDOMComponent: function (inst) {
118
+ return !!(inst && inst.nodeType === 1 && inst.tagName);
119
+ },
120
+
121
+ isDOMComponentElement: function (inst) {
122
+ return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
123
+ },
124
+
125
+ isCompositeComponent: function (inst) {
126
+ if (ReactTestUtils.isDOMComponent(inst)) {
127
+ // Accessing inst.setState warns; just return false as that'll be what
128
+ // this returns when we have DOM nodes as refs directly
129
+ return false;
130
+ }
131
+ return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
132
+ },
133
+
134
+ isCompositeComponentWithType: function (inst, type) {
135
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
136
+ return false;
137
+ }
138
+ var internalInstance = ReactInstanceMap.get(inst);
139
+ var constructor = internalInstance._currentElement.type;
140
+
141
+ return constructor === type;
142
+ },
143
+
144
+ isCompositeComponentElement: function (inst) {
145
+ if (!ReactElement.isValidElement(inst)) {
146
+ return false;
147
+ }
148
+ // We check the prototype of the type that will get mounted, not the
149
+ // instance itself. This is a future proof way of duck typing.
150
+ var prototype = inst.type.prototype;
151
+ return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
152
+ },
153
+
154
+ isCompositeComponentElementWithType: function (inst, type) {
155
+ var internalInstance = ReactInstanceMap.get(inst);
156
+ var constructor = internalInstance._currentElement.type;
157
+
158
+ return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
159
+ },
160
+
161
+ getRenderedChildOfCompositeComponent: function (inst) {
162
+ if (!ReactTestUtils.isCompositeComponent(inst)) {
163
+ return null;
164
+ }
165
+ var internalInstance = ReactInstanceMap.get(inst);
166
+ return internalInstance._renderedComponent.getPublicInstance();
167
+ },
168
+
169
+ findAllInRenderedTree: function (inst, test) {
170
+ if (!inst) {
171
+ return [];
172
+ }
173
+ !ReactTestUtils.isCompositeComponent(inst) ? true ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : void 0;
174
+ return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
175
+ },
176
+
177
+ /**
178
+ * Finds all instance of components in the rendered tree that are DOM
179
+ * components with the class name matching `className`.
180
+ * @return {array} an array of all the matches.
181
+ */
182
+ scryRenderedDOMComponentsWithClass: function (root, classNames) {
183
+ if (!Array.isArray(classNames)) {
184
+ classNames = classNames.split(/\s+/);
185
+ }
186
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
187
+ if (ReactTestUtils.isDOMComponent(inst)) {
188
+ var className = inst.className;
189
+ if (typeof className !== 'string') {
190
+ // SVG, probably.
191
+ className = inst.getAttribute('class') || '';
192
+ }
193
+ var classList = className.split(/\s+/);
194
+ return classNames.every(function (name) {
195
+ return classList.indexOf(name) !== -1;
196
+ });
197
+ }
198
+ return false;
199
+ });
200
+ },
201
+
202
+ /**
203
+ * Like scryRenderedDOMComponentsWithClass but expects there to be one result,
204
+ * and returns that one result, or throws exception if there is any other
205
+ * number of matches besides one.
206
+ * @return {!ReactDOMComponent} The one match.
207
+ */
208
+ findRenderedDOMComponentWithClass: function (root, className) {
209
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
210
+ if (all.length !== 1) {
211
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for class:' + className);
212
+ }
213
+ return all[0];
214
+ },
215
+
216
+ /**
217
+ * Finds all instance of components in the rendered tree that are DOM
218
+ * components with the tag name matching `tagName`.
219
+ * @return {array} an array of all the matches.
220
+ */
221
+ scryRenderedDOMComponentsWithTag: function (root, tagName) {
222
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
223
+ return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
224
+ });
225
+ },
226
+
227
+ /**
228
+ * Like scryRenderedDOMComponentsWithTag but expects there to be one result,
229
+ * and returns that one result, or throws exception if there is any other
230
+ * number of matches besides one.
231
+ * @return {!ReactDOMComponent} The one match.
232
+ */
233
+ findRenderedDOMComponentWithTag: function (root, tagName) {
234
+ var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
235
+ if (all.length !== 1) {
236
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for tag:' + tagName);
237
+ }
238
+ return all[0];
239
+ },
240
+
241
+ /**
242
+ * Finds all instances of components with type equal to `componentType`.
243
+ * @return {array} an array of all the matches.
244
+ */
245
+ scryRenderedComponentsWithType: function (root, componentType) {
246
+ return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
247
+ return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
248
+ });
249
+ },
250
+
251
+ /**
252
+ * Same as `scryRenderedComponentsWithType` but expects there to be one result
253
+ * and returns that one result, or throws exception if there is any other
254
+ * number of matches besides one.
255
+ * @return {!ReactComponent} The one match.
256
+ */
257
+ findRenderedComponentWithType: function (root, componentType) {
258
+ var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
259
+ if (all.length !== 1) {
260
+ throw new Error('Did not find exactly one match (found: ' + all.length + ') ' + 'for componentType:' + componentType);
261
+ }
262
+ return all[0];
263
+ },
264
+
265
+ /**
266
+ * Pass a mocked component module to this method to augment it with
267
+ * useful methods that allow it to be used as a dummy React component.
268
+ * Instead of rendering as usual, the component will become a simple
269
+ * <div> containing any provided children.
270
+ *
271
+ * @param {object} module the mock function object exported from a
272
+ * module that defines the component to be mocked
273
+ * @param {?string} mockTagName optional dummy root tag name to return
274
+ * from render method (overrides
275
+ * module.mockTagName if provided)
276
+ * @return {object} the ReactTestUtils object (for chaining)
277
+ */
278
+ mockComponent: function (module, mockTagName) {
279
+ mockTagName = mockTagName || module.mockTagName || 'div';
280
+
281
+ module.prototype.render.mockImplementation(function () {
282
+ return React.createElement(mockTagName, null, this.props.children);
283
+ });
284
+
285
+ return this;
286
+ },
287
+
288
+ /**
289
+ * Simulates a top level event being dispatched from a raw event that occurred
290
+ * on an `Element` node.
291
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
292
+ * @param {!Element} node The dom to simulate an event occurring on.
293
+ * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
294
+ */
295
+ simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
296
+ fakeNativeEvent.target = node;
297
+ ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
298
+ },
299
+
300
+ /**
301
+ * Simulates a top level event being dispatched from a raw event that occurred
302
+ * on the `ReactDOMComponent` `comp`.
303
+ * @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
304
+ * @param {!ReactDOMComponent} comp
305
+ * @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
306
+ */
307
+ simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
308
+ ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
309
+ },
310
+
311
+ nativeTouchData: function (x, y) {
312
+ return {
313
+ touches: [{ pageX: x, pageY: y }]
314
+ };
315
+ },
316
+
317
+ createRenderer: function () {
318
+ return new ReactShallowRenderer();
319
+ },
320
+
321
+ Simulate: null,
322
+ SimulateNative: {}
323
+ };
324
+
325
+ /**
326
+ * @class ReactShallowRenderer
327
+ */
328
+ var ReactShallowRenderer = function () {
329
+ this._instance = null;
330
+ };
331
+
332
+ ReactShallowRenderer.prototype.getMountedInstance = function () {
333
+ return this._instance ? this._instance._instance : null;
334
+ };
335
+
336
+ var NoopInternalComponent = function (element) {
337
+ this._renderedOutput = element;
338
+ this._currentElement = element;
339
+ };
340
+
341
+ NoopInternalComponent.prototype = {
342
+
343
+ mountComponent: function () {},
344
+
345
+ receiveComponent: function (element) {
346
+ this._renderedOutput = element;
347
+ this._currentElement = element;
348
+ },
349
+
350
+ getNativeNode: function () {
351
+ return undefined;
352
+ },
353
+
354
+ unmountComponent: function () {},
355
+
356
+ getPublicInstance: function () {
357
+ return null;
358
+ }
359
+ };
360
+
361
+ var ShallowComponentWrapper = function (element) {
362
+ this.construct(element);
363
+ };
364
+ _assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
365
+ _instantiateReactComponent: function (element) {
366
+ return new NoopInternalComponent(element);
367
+ },
368
+ _replaceNodeWithMarkup: function () {},
369
+ _renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
370
+ });
371
+
372
+ ReactShallowRenderer.prototype.render = function (element, context) {
373
+ // Ensure we've done the default injections. This might not be true in the
374
+ // case of a simple test that only requires React and the TestUtils in
375
+ // conjunction with an inline-requires transform.
376
+ ReactDefaultInjection.inject();
377
+
378
+ !ReactElement.isValidElement(element) ? true ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : void 0;
379
+ !(typeof element.type !== 'string') ? true ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : void 0;
380
+
381
+ if (!context) {
382
+ context = emptyObject;
383
+ }
384
+ ReactUpdates.batchedUpdates(_batchedRender, this, element, context);
385
+
386
+ return this.getRenderOutput();
387
+ };
388
+
389
+ function _batchedRender(renderer, element, context) {
390
+ var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(true);
391
+ renderer._render(element, transaction, context);
392
+ ReactUpdates.ReactReconcileTransaction.release(transaction);
393
+ }
394
+
395
+ ReactShallowRenderer.prototype.getRenderOutput = function () {
396
+ return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
397
+ };
398
+
399
+ ReactShallowRenderer.prototype.unmount = function () {
400
+ if (this._instance) {
401
+ this._instance.unmountComponent(false);
402
+ }
403
+ };
404
+
405
+ ReactShallowRenderer.prototype._render = function (element, transaction, context) {
406
+ if (this._instance) {
407
+ this._instance.receiveComponent(element, transaction, context);
408
+ } else {
409
+ var instance = new ShallowComponentWrapper(element);
410
+ instance.mountComponent(transaction, null, null, context);
411
+ this._instance = instance;
412
+ }
413
+ };
414
+
415
+ /**
416
+ * Exports:
417
+ *
418
+ * - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
419
+ * - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
420
+ * - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
421
+ * - ... (All keys from event plugin `eventTypes` objects)
422
+ */
423
+ function makeSimulator(eventType) {
424
+ return function (domComponentOrNode, eventData) {
425
+ var node;
426
+ !!React.isValidElement(domComponentOrNode) ? true ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.' + 'TestUtils.Simulate will not work if you are using shallow rendering.') : invariant(false) : void 0;
427
+ if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
428
+ node = findDOMNode(domComponentOrNode);
429
+ } else if (domComponentOrNode.tagName) {
430
+ node = domComponentOrNode;
431
+ }
432
+
433
+ var dispatchConfig = EventPluginRegistry.eventNameDispatchConfigs[eventType];
434
+
435
+ var fakeNativeEvent = new Event();
436
+ fakeNativeEvent.target = node;
437
+ // We don't use SyntheticEvent.getPooled in order to not have to worry about
438
+ // properly destroying any properties assigned from `eventData` upon release
439
+ var event = new SyntheticEvent(dispatchConfig, ReactDOMComponentTree.getInstanceFromNode(node), fakeNativeEvent, node);
440
+ // Since we aren't using pooling, always persist the event. This will make
441
+ // sure it's marked and won't warn when setting additional properties.
442
+ event.persist();
443
+ _assign(event, eventData);
444
+
445
+ if (dispatchConfig.phasedRegistrationNames) {
446
+ EventPropagators.accumulateTwoPhaseDispatches(event);
447
+ } else {
448
+ EventPropagators.accumulateDirectDispatches(event);
449
+ }
450
+
451
+ ReactUpdates.batchedUpdates(function () {
452
+ EventPluginHub.enqueueEvents(event);
453
+ EventPluginHub.processEventQueue(true);
454
+ });
455
+ };
456
+ }
457
+
458
+ function buildSimulators() {
459
+ ReactTestUtils.Simulate = {};
460
+
461
+ var eventType;
462
+ for (eventType in EventPluginRegistry.eventNameDispatchConfigs) {
463
+ /**
464
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
465
+ * @param {?object} eventData Fake event data to use in SyntheticEvent.
466
+ */
467
+ ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
468
+ }
469
+ }
470
+
471
+ // Rebuild ReactTestUtils.Simulate whenever event plugins are injected
472
+ var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
473
+ EventPluginHub.injection.injectEventPluginOrder = function () {
474
+ oldInjectEventPluginOrder.apply(this, arguments);
475
+ buildSimulators();
476
+ };
477
+ var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
478
+ EventPluginHub.injection.injectEventPluginsByName = function () {
479
+ oldInjectEventPlugins.apply(this, arguments);
480
+ buildSimulators();
481
+ };
482
+
483
+ buildSimulators();
484
+
485
+ /**
486
+ * Exports:
487
+ *
488
+ * - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
489
+ * - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
490
+ * - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
491
+ * - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
492
+ * - ... (All keys from `EventConstants.topLevelTypes`)
493
+ *
494
+ * Note: Top level event types are a subset of the entire set of handler types
495
+ * (which include a broader set of "synthetic" events). For example, onDragDone
496
+ * is a synthetic event. Except when testing an event plugin or React's event
497
+ * handling code specifically, you probably want to use ReactTestUtils.Simulate
498
+ * to dispatch synthetic events.
499
+ */
500
+
501
+ function makeNativeSimulator(eventType) {
502
+ return function (domComponentOrNode, nativeEventData) {
503
+ var fakeNativeEvent = new Event(eventType);
504
+ _assign(fakeNativeEvent, nativeEventData);
505
+ if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
506
+ ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
507
+ } else if (domComponentOrNode.tagName) {
508
+ // Will allow on actual dom nodes.
509
+ ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
510
+ }
511
+ };
512
+ }
513
+
514
+ Object.keys(topLevelTypes).forEach(function (eventType) {
515
+ // Event type is stored as 'topClick' - we transform that to 'click'
516
+ var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
517
+ /**
518
+ * @param {!Element|ReactDOMComponent} domComponentOrNode
519
+ * @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
520
+ */
521
+ ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
522
+ });
523
+
524
+ module.exports = ReactTestUtils;
525
+
526
+ /***/ },
527
+
528
+ /***/ 928:
529
+ /***/ function(module, exports) {
530
+
531
+ 'use strict';
532
+
533
+ exports.__esModule = true;
534
+ exports['default'] = deepForceUpdate;
535
+ function traverseRenderedChildren(internalInstance, callback, argument) {
536
+ callback(internalInstance, argument);
537
+
538
+ if (internalInstance._renderedComponent) {
539
+ traverseRenderedChildren(internalInstance._renderedComponent, callback, argument);
540
+ } else {
541
+ for (var key in internalInstance._renderedChildren) {
542
+ if (internalInstance._renderedChildren.hasOwnProperty(key)) {
543
+ traverseRenderedChildren(internalInstance._renderedChildren[key], callback, argument);
544
+ }
545
+ }
546
+ }
547
+ }
548
+
549
+ function setPendingForceUpdate(internalInstance) {
550
+ if (internalInstance._pendingForceUpdate === false) {
551
+ internalInstance._pendingForceUpdate = true;
552
+ }
553
+ }
554
+
555
+ function forceUpdateIfPending(internalInstance) {
556
+ if (internalInstance._pendingForceUpdate === true) {
557
+ var publicInstance = internalInstance._instance;
558
+ var updater = publicInstance.updater;
559
+
560
+ if (typeof publicInstance.forceUpdate === 'function') {
561
+ publicInstance.forceUpdate();
562
+ } else if (updater && typeof updater.enqueueForceUpdate === 'function') {
563
+ updater.enqueueForceUpdate(publicInstance);
564
+ }
565
+ }
566
+ }
567
+
568
+ function deepForceUpdate(instance) {
569
+ var internalInstance = instance._reactInternalInstance;
570
+ traverseRenderedChildren(internalInstance, setPendingForceUpdate);
571
+ traverseRenderedChildren(internalInstance, forceUpdateIfPending);
572
+ }
573
+
574
+ module.exports = exports['default'];
575
+
576
+ /***/ }
577
+
578
+ });