Skip to content

Commit

Permalink
Revert ReactBrowserEventEmitter-test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
nhunzaker committed Nov 16, 2017
1 parent 30dd684 commit 85fd3ed
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -373,27 +373,26 @@ describe('ReactBrowserEventEmitter', () => {
});

it('should listen to events only once', () => {
let button = document.createElement('button');
spyOn(EventTarget.prototype, 'addEventListener');
ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, button);
ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, button);
ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document);
ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document);
expect(EventTarget.prototype.addEventListener.calls.count()).toBe(1);
});

it('should work with event plugins without dependencies', () => {
let button = document.createElement('button');
spyOn(EventTarget.prototype, 'addEventListener');
ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, button);

ReactBrowserEventEmitter.listenTo(ON_CLICK_KEY, document);

expect(EventTarget.prototype.addEventListener.calls.argsFor(0)[0]).toBe(
'click',
);
});

it('should work with event plugins with dependencies', () => {
let button = document.createElement('button');
spyOn(EventTarget.prototype, 'addEventListener');

ReactBrowserEventEmitter.listenTo(ON_CHANGE_KEY, button);
ReactBrowserEventEmitter.listenTo(ON_CHANGE_KEY, document);

var setEventListeners = [];
var listenCalls = EventTarget.prototype.addEventListener.calls.allArgs();
Expand Down

0 comments on commit 85fd3ed

Please sign in to comment.