How to use the @inkline/inkline/helpers/addClass.addClass 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 / addClass.spec.js View on Github external
it('should not add class if class already exists', () => {
                element.className = 'test';

                addClass(element, 'test');

                expect(element.className).toEqual('test');
            });
github inkline / inkline / tests / unit / helpers / addClass.spec.js View on Github external
it('should return if element not provided', () => {
            expect(addClass(undefined, undefined)).toEqual(undefined);
        });
github inkline / inkline / tests / unit / helpers / addClass.spec.js View on Github external
it('should add a class', () => {
                addClass(element, 'class');

                expect(element.className).toEqual(' class');
            });
github inkline / inkline / tests / unit / helpers / addClass.spec.js View on Github external
it('should add multiple classes', () => {
                const spy = jest.spyOn(element.classList, 'add');

                addClass(element, 'class1 class2');

                expect(spy).toHaveBeenCalledTimes(2);
                expect(spy).toHaveBeenCalledWith('class1');
                expect(spy).toHaveBeenCalledWith('class2');
            });
        });
github inkline / inkline / tests / unit / helpers / addClass.spec.js View on Github external
it('should not add any class if classes not provided', () => {
                addClass(element, '');

                expect(element.className).toEqual(undefined);
            });