UNPKG

@age/quantum

Version:
40 lines (31 loc) 1.91 kB
"use strict"; var _IconTypes = require("./IconTypes"); var _theme = require("../shared/theme"); function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } var skins = _theme.components.snackbar.skins; var themeIcons = {}; Object.entries(skins).forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 1), key = _ref2[0]; if ((0, _IconTypes.GetSkinIcon)(key) !== '') themeIcons[key] = (0, _IconTypes.GetSkinIcon)(key); return themeIcons; }); describe('IconTypes unit tests', function () { it('should skin returns its matched skin icon', function () { Object.entries((0, _IconTypes.GetAllSkinsIcons)()).forEach(function (_ref3) { var _ref4 = _slicedToArray(_ref3, 2), skin = _ref4[0], skinIconName = _ref4[1]; expect((0, _IconTypes.GetSkinIcon)(skin)).toMatch(skinIconName); }); }); it('should neutral skin not returns skin icon', function () { expect((0, _IconTypes.GetSkinIcon)('neutral')).toMatch(''); }); it('should GetAllSkinsIcons returns the correct theme object', function () { expect((0, _IconTypes.GetAllSkinsIcons)()).toMatchObject(themeIcons); }); });