UNPKG

stylesheet-loader

Version:
33 lines 1.82 kB
"use strict"; var _this = this; Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = require("../index"); var css = require("css"); var loaderUtils = require("loader-utils"); describe('getFontFaceContent', function () { it('should convert `@font-face` correctly when use double quotes', function () { var font = "@font-face {\n font-family: \"Open Sans\";\n src: url(\"/fonts/OpenSans-Regular-webfont.woff2\") format(\"woff2\"),\n url(\"/fonts/OpenSans-Regular-webfont.woff\") format(\"woff\");\n}"; // getOptions can return null if no query passed. var parsedQuery = loaderUtils.getOptions(_this) || {}; // Compatible with string true. if (parsedQuery.log === 'true') { parsedQuery.log = true; } var stylesheet = css.parse(font).stylesheet; var fontFaceRules = index_1.parse(parsedQuery, stylesheet).fontFaceRules; expect(index_1.getFontFaceContent(fontFaceRules)).toMatchSnapshot(); }); it('should convert `@font-face` correctly when use single quotes', function () { var font = "@font-face {\n font-family: 'Open Sans';\n src: url('/fonts/OpenSans-Regular-webfont.woff2') format('woff2'),\n url('/fonts/OpenSans-Regular-webfont.woff') format('woff');\n}"; // getOptions can return null if no query passed. var parsedQuery = loaderUtils.getOptions(_this) || {}; // Compatible with string true. if (parsedQuery.log === 'true') { parsedQuery.log = true; } var stylesheet = css.parse(font).stylesheet; var fontFaceRules = index_1.parse(parsedQuery, stylesheet).fontFaceRules; expect(index_1.getFontFaceContent(fontFaceRules)).toMatchSnapshot(); }); }); //# sourceMappingURL=getFontFaceContent.js.map