UNPKG

react-native-easy-calendar

Version:

Customizable, easy-to-use, performant calendar components for React Native

53 lines (50 loc) 1.93 kB
"use strict"; var _addOpacity = _interopRequireDefault(require("./addOpacity")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } describe('Converts color #rrggbb to #rrggbbaa', () => { test('Should return #0000001A for opacity 0.1 (10%)', () => { const color = '#000000'; const opacity = 0.1; const after = '#0000001A'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); test('Should return #00000040 for opacity 0.25 (25%)', () => { const color = '#000000'; const opacity = 0.25; const after = '#00000040'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); test('Should return #0000007F for opacity 0.5 (50%)', () => { const color = '#000000'; const opacity = 0.5; const after = '#00000080'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); test('Should return #000000BF for opacity 0.75 (75%)', () => { const color = '#000000'; const opacity = 0.75; const after = '#000000BF'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); test('Should return #000000FF for opacity 1 (100%)', () => { const color = '#000000'; const opacity = 1; const after = '#000000FF'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); }); describe('Handle opacity out of range (less then 0 or greater than 1)', () => { test('Should return #000000FF for an opacity greater than 1', () => { const color = '#000000'; const opacity = 100; const after = '#000000FF'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); test('Should return #000000FF for an opacity less than 0', () => { const color = '#000000'; const opacity = -20; const after = '#00000000'; expect((0, _addOpacity.default)(color, opacity)).toBe(after); }); }); //# sourceMappingURL=addOpacity.test.js.map