UNPKG

linear-gradient-parser

Version:

Parses a SVG linear gradient string / parsed JSON into css background image property

29 lines (21 loc) 690 B
import getStopOffset from '.'; describe('utils / getStopOffset', () => { describe('When offset is a number', () => { const offset = 1; it('Returns as percentage', () => { expect(getStopOffset(offset)).toEqual(100); }); }); describe('When offset is a number string', () => { const offset = '0.5'; it('Returns as percentage', () => { expect(getStopOffset(offset)).toEqual(50); }); }); describe('When offset is a percentage string', () => { const offset = '75%'; it('Returns as percentage', () => { expect(getStopOffset(offset)).toEqual(75); }); }); });