From def41dfd8ff0eb292d4a078a00f94a8cda71d061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Thu, 11 Sep 2014 14:45:41 -0700 Subject: [PATCH] Move onscroll warning test This moves it to the appropriate place to accomodate the move of the check. --- .../ui/__tests__/ReactDOMComponent-test.js | 22 +++++++++++++++++++ src/event/__tests__/EventPluginHub-test.js | 9 -------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/browser/ui/__tests__/ReactDOMComponent-test.js b/src/browser/ui/__tests__/ReactDOMComponent-test.js index b283a004e9..ef971bbac6 100644 --- a/src/browser/ui/__tests__/ReactDOMComponent-test.js +++ b/src/browser/ui/__tests__/ReactDOMComponent-test.js @@ -418,4 +418,26 @@ describe('ReactDOMComponent', function() { }); }); + describe('onScroll warning', function() { + it('should warn about the `onScroll` issue when unsupported (IE8)', () => { + // Mock this here so we can mimic IE8 support. We require isEventSupported + // before React so it's pre-mocked before React qould require it. + require('mock-modules') + .dumpCache() + .mock('isEventSupported'); + var isEventSupported = require('isEventSupported'); + isEventSupported.mockReturnValueOnce(false); + + var React = require('React'); + var ReactTestUtils = require('ReactTestUtils'); + + spyOn(console, 'warn'); + ReactTestUtils.renderIntoDocument(
); + expect(console.warn.callCount).toBe(1); + expect(console.warn.mostRecentCall.args[0]).toBe( + 'This browser doesn\'t support the `onScroll` event' + ); + }); + }); + }); diff --git a/src/event/__tests__/EventPluginHub-test.js b/src/event/__tests__/EventPluginHub-test.js index 808be87d31..95103ce13e 100644 --- a/src/event/__tests__/EventPluginHub-test.js +++ b/src/event/__tests__/EventPluginHub-test.js @@ -33,15 +33,6 @@ describe('EventPluginHub', function() { isEventSupported.mockReturnValueOnce(false); }); - it('should warn about the `onScroll` issue on IE8', function() { - spyOn(console, 'warn'); - EventPluginHub.putListener(1, 'onScroll', function(){}); - expect(console.warn.callCount).toBe(1); - expect(console.warn.mostRecentCall.args[0]).toBe( - 'This browser doesn\'t support the `onScroll` event' - ); - }); - it("should prevent non-function listeners", function() { expect(function() { EventPluginHub.putListener(1, 'onClick', 'not a function');