Move onscroll warning test

This moves it to the appropriate place to accomodate the move of the check.
This commit is contained in:
Paul O’Shannessy
2014-09-11 14:45:41 -07:00
parent 7ae8909504
commit def41dfd8f
2 changed files with 22 additions and 9 deletions
@@ -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(<div onScroll={function(){}} />);
expect(console.warn.callCount).toBe(1);
expect(console.warn.mostRecentCall.args[0]).toBe(
'This browser doesn\'t support the `onScroll` event'
);
});
});
});
@@ -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');