How to use the @inkline/inkline/src/helpers/triggerEvent.triggerEvent function in @inkline/inkline

To help you get started, we’ve selected a few @inkline/inkline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github inkline / inkline / tests / unit / helpers / triggerEvent.spec.js View on Github external
it('should return if Vue.$isServer', () => {
            isServer(true);
            expect(triggerEvent(element, 'eventName')).not.toBeDefined();
            isServer(false);
        });
github inkline / inkline / tests / unit / helpers / triggerEvent.spec.js View on Github external
it('should trigger an event of type HTMLEvents', () => {
                const eventName = 'other';
                const eventType = 'HTMLEvents';
                const spy = jest.spyOn(element, 'dispatchEvent');

                const event = document.createEvent(eventType);
                event.initEvent(eventName);

                triggerEvent(element, eventName);

                expect(spy).toHaveBeenCalled();
                expect(spy).toHaveBeenCalledWith(event);
            });
github inkline / inkline / tests / unit / helpers / triggerEvent.spec.js View on Github external
it('should trigger an event of type MouseEvents', () => {
                const eventName = 'mousemove';
                const eventType = 'MouseEvents';
                const spy = jest.spyOn(element, 'dispatchEvent');

                const event = document.createEvent(eventType);
                event.initEvent(eventName);

                triggerEvent(element, eventName);


                expect(spy).toHaveBeenCalled();
                expect(spy).toHaveBeenCalledWith(event);
            });
github inkline / inkline / tests / unit / helpers / triggerEvent.spec.js View on Github external
it('should trigger an event of type KeyboardEvent', () => {
                const eventName = 'keypress';
                const eventType = 'KeyboardEvent';
                const spy = jest.spyOn(element, 'fireEvent');

                const event = document.createEvent(eventType);
                event.initEvent(eventName);

                triggerEvent(element, eventName);


                expect(spy).toHaveBeenCalled();
                expect(spy).toHaveBeenCalledWith('on' + eventName, event);
            });
github inkline / inkline / tests / unit / helpers / triggerEvent.spec.js View on Github external
it('should set event options', () => {
                const eventName = 'mousemove';
                const eventType = 'MouseEvents';
                const spy = jest.spyOn(element, 'dispatchEvent');

                const event = document.createEvent(eventType);
                event.initEvent(eventName);

                triggerEvent(element, 'eventName', { cancelable: true, custom: true });

                expect(spy).toHaveBeenCalled();
            });
        });