How to use the @inkline/inkline/src/helpers/removeClass.removeClass 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 / removeClass.spec.js View on Github external
it('should return if classes not provided', () => {
            expect(removeClass(true, undefined)).toEqual(undefined);
        });
github inkline / inkline / tests / unit / helpers / removeClass.spec.js View on Github external
it('should return if element not provided', () => {
            expect(removeClass(undefined, undefined)).toEqual(undefined);
        });
github inkline / inkline / tests / unit / helpers / removeClass.spec.js View on Github external
it('should add a class', () => {
                const spy = jest.spyOn(element.classList, 'remove');

                removeClass(element, 'class');

                expect(spy).toHaveBeenCalled();
                expect(spy).toHaveBeenCalledWith('class');
            });
github inkline / inkline / tests / unit / helpers / removeClass.spec.js View on Github external
it('should continue if empty string given', () => {
                element.className = 'class1 class2';

                removeClass(element, ' ');

                expect(element.className).toEqual('class1 class2');
            });
        });
github inkline / inkline / tests / unit / helpers / removeClass.spec.js View on Github external
it('should not remove class if class doesn\'t exist', () => {
                element.className = 'other';

                removeClass(element, 'test');

                expect(element.className).toEqual('other');
            });
github inkline / inkline / tests / unit / helpers / removeClass.spec.js View on Github external
it('should ignore double spaces', () => {
                element.className = 'class1   class2';

                removeClass(element, 'class1');

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

                removeClass(element, 'class1 class2');

                expect(spy).toHaveBeenCalledTimes(2);
                expect(spy).toHaveBeenCalledWith('class1');
                expect(spy).toHaveBeenCalledWith('class2');
            });
        });