UNPKG

font-awesome-assets-updated

Version:

Convert any of @FortAwesome's Font-Awesome icons to an asset, such as an <svg> tag or a Base64-encoded PNG/SVG <img> tag! It supports Retina devices and custom tag attributes too! This package was built for @CrocodileJS.

33 lines (26 loc) 935 B
import m from '../src'; describe('svg', () => { it('should return svg', () => { m.svg('long-arrow-alt-right'); }); it('should return 2 different svg', () => { const black = m.svg('newspaper'); const red = m.svg('newspaper', 'red'); expect(black).not.toEqual(red); }); it('should allow optional "fa-" prefix in the name', () => { const el1 = m.svg('newspaper'); const el2 = m.svg('fa-newspaper'); expect(el1).toEqual(el2); }); it('should throw a `name` error', () => { expect(() => m.svg([])).toThrowError('fa.svg `name` must be a String'); }); it('should throw a `color` error', () => { expect(() => m.svg('newspaper', [])).toThrowError('fa.svg `color` must be a String'); }); it('should throw an invalid font error', () => { expect(() => m.svg('THIS_IS_INVALID')) .toThrowError('fa.svg name "this_is_invalid" must be a valid FontAwesome icon name'); }); });