mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Move onscroll warning test
This moves it to the appropriate place to accomodate the move of the check.
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user