mirror of
https://github.com/Shopify/draggable.git
synced 2026-02-01 16:46:56 +00:00
Add tests for AbstractEvent
Simplify import path Move test to new location
This commit is contained in:
parent
84e798afe3
commit
42535bd6b5
47
src/shared/AbstractEvent/tests/AbstractEvent.test.js
Normal file
47
src/shared/AbstractEvent/tests/AbstractEvent.test.js
Normal file
@ -0,0 +1,47 @@
|
||||
import AbstractEvent from './../AbstractEvent';
|
||||
|
||||
describe('AbstractEvent', () => {
|
||||
test('should be of type AbstractEvent', () => {
|
||||
const event = new AbstractEvent();
|
||||
|
||||
expect(event).toBeInstanceOf(AbstractEvent);
|
||||
});
|
||||
|
||||
test('should initialize with correct type', () => {
|
||||
const event = new AbstractEvent();
|
||||
|
||||
expect(event.type).toBe('event');
|
||||
});
|
||||
|
||||
test('should initialize in uncancelable state', () => {
|
||||
const event = new AbstractEvent();
|
||||
|
||||
expect(event.cancelable).toBe(false);
|
||||
});
|
||||
|
||||
test('should initialize in uncancelled state', () => {
|
||||
const event = new AbstractEvent();
|
||||
|
||||
expect(event.canceled()).toBe(false);
|
||||
});
|
||||
|
||||
test('should initialize with data', () => {
|
||||
const event = new AbstractEvent({
|
||||
foo: 'bar',
|
||||
});
|
||||
|
||||
expect(event.data).toMatchObject({
|
||||
foo: 'bar',
|
||||
});
|
||||
});
|
||||
|
||||
test('should cancel event', () => {
|
||||
const event = new AbstractEvent();
|
||||
|
||||
expect(event.canceled()).toBe(false);
|
||||
|
||||
event.cancel();
|
||||
|
||||
expect(event.canceled()).toBe(true);
|
||||
});
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user