-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWindowResizedEventSubscriberTest.js
47 lines (36 loc) · 1.34 KB
/
WindowResizedEventSubscriberTest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* This file is part of the EventBusJS library.
*
* Copyright (c) 2016-present LIN3S <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Beñat Espiña <[email protected]>
* @author Mikel Tuesta <[email protected]>
*/
'use strict';
import test from 'ava';
import 'babel-core/register';
import WindowResizedEventSubscriber from './../src/WindowResizedEventSubscriber';
import Event from './../src/Event';
import WindowResizedEvent from './../src/WindowResizedEvent';
test('it subscribes to handled event', (t) => {
const
windowResizedEventSubscriber = new WindowResizedEventSubscriber(() => {
console.log('callback');
}),
windowResizedEvent = new WindowResizedEvent();
windowResizedEventSubscriber.handle(windowResizedEvent);
t.is(windowResizedEventSubscriber.isSubscribedTo(windowResizedEvent), true);
});
test('it does not subscribe to unhandled event', (t) => {
const
windowResizedEventSubscriber = new WindowResizedEventSubscriber(() => {
console.log('callback');
}),
windowResizedEvent = new WindowResizedEvent(),
otherEvent = new Event('OTHER_EVENT');
windowResizedEventSubscriber.handle(windowResizedEvent);
t.is(windowResizedEventSubscriber.isSubscribedTo(otherEvent), false);
});