|
| 1 | +/** |
| 2 | + * Copyright 2013 Facebook, Inc. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + * |
| 16 | + * @emails react-core |
| 17 | + */ |
| 18 | + |
| 19 | +"use strict"; |
| 20 | + |
| 21 | +require('mock-modules') |
| 22 | + .dontMock('CallbackRegistry') |
| 23 | + .mock('isEventSupported'); |
| 24 | + |
| 25 | +describe('CallbackRegistry', function() { |
| 26 | + var CallbackRegistry; |
| 27 | + var isEventSupported; |
| 28 | + |
| 29 | + beforeEach(function() { |
| 30 | + require('mock-modules').dumpCache(); |
| 31 | + CallbackRegistry = require('CallbackRegistry'); |
| 32 | + isEventSupported = require('isEventSupported'); |
| 33 | + isEventSupported.mockReturnValue(false); |
| 34 | + }); |
| 35 | + |
| 36 | + it('should warn about the `onScroll` issue on IE8', function() { |
| 37 | + spyOn(console, 'warn'); |
| 38 | + CallbackRegistry.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 | + |
| 45 | +}); |
0 commit comments