Move onscroll warning test
This moves it to the appropriate place to accomodate the move of the check.
Paul O’Shannessy committed
Sep 11, 2014 at 14:45 UTC
def41dfd8ff0eb292d4a078a00f94a8cda71d061
2 files changed
+22
-9
src/browser/ui/__tests__/ReactDOMComponent-test.js
+22
@@ -418,4 +418,26 @@ describe('ReactDOMComponent', function() {
418
});
419
});
420
421
+ describe('onScroll warning', function() {
422
+ it('should warn about the `onScroll` issue when unsupported (IE8)', () => {
423
+ // Mock this here so we can mimic IE8 support. We require isEventSupported
424
+ // before React so it's pre-mocked before React qould require it.
425
+ require('mock-modules')
426
+ .dumpCache()
427
+ .mock('isEventSupported');
428
+ var isEventSupported = require('isEventSupported');
429
+ isEventSupported.mockReturnValueOnce(false);
430
+
431
+ var React = require('React');
432
+ var ReactTestUtils = require('ReactTestUtils');
433
+
434
+ spyOn(console, 'warn');
435
+ ReactTestUtils.renderIntoDocument(<div onScroll={function(){}} />);
436
+ expect(console.warn.callCount).toBe(1);
437
+ expect(console.warn.mostRecentCall.args[0]).toBe(
438
+ 'This browser doesn\'t support the `onScroll` event'
439
+ );
440
+ });
441
+ });
442
+
443
});
src/event/__tests__/EventPluginHub-test.js
-9
@@ -33,15 +33,6 @@ describe('EventPluginHub', function() {
33
isEventSupported.mockReturnValueOnce(false);
34
});
35
36
- it('should warn about the `onScroll` issue on IE8', function() {
37
- spyOn(console, 'warn');
38
- EventPluginHub.putListener(1, 'onScroll', function(){});
39
- expect(console.warn.callCount).toBe(1);
40
- expect(console.warn.mostRecentCall.args[0]).toBe(
41
- 'This browser doesn\'t support the `onScroll` event'
42
- );
43
- });
44
-
36
it("should prevent non-function listeners", function() {
37
expect(function() {
38
EventPluginHub.putListener(1, 'onClick', 'not a function');