How to use the @inkline/inkline/helpers/hasClass.hasClass 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 / hasClass.spec.js View on Github external
it('should return false if className not defined', () => {
            expect(hasClass({}, undefined)).toEqual(false);
        });
github inkline / inkline / tests / unit / helpers / hasClass.spec.js View on Github external
it('should return false if element not defined', () => {
            expect(hasClass(undefined, 'test')).toEqual(false);
        });
github inkline / inkline / tests / unit / helpers / hasClass.spec.js View on Github external
it('should return true if className found', () => {
                element.className = 'class';

                expect(hasClass(element, 'class')).toEqual(true);
            });
        });
github inkline / inkline / tests / unit / helpers / hasClass.spec.js View on Github external
it('should call classList contains()', () => {
                const spy = jest.spyOn(element.classList, 'contains');

                hasClass(element, 'other');

                expect(spy).toHaveBeenCalled();
            });
        });
github inkline / inkline / tests / unit / helpers / hasClass.spec.js View on Github external
it('should return false if className not found', () => {
                element.className = 'class';

                expect(hasClass(element, 'other')).toEqual(false);
            });
github inkline / inkline / tests / unit / helpers / hasClass.spec.js View on Github external
            expect(() => hasClass({}, 'class1 class2')).toThrowError();
        });