UNPKG

@enact/ui

Version:

A collection of simplified unstyled cross-platform UI components for Enact

32 lines (31 loc) 1.39 kB
"use strict"; require("@testing-library/jest-dom"); var _localizedFonts = require("../localized-fonts"); describe('localized-fonts', function () { beforeEach(function () { var fontName = 'Enact'; var fonts = { 'ja': { regular: 'LG Smart UI JP' }, 'ur': { regular: ['LG Smart UI Urdu', 'LGSmartUIUrdu'] // This needs 2 references because the "full name" differs from the "family name". To target this font file directly in all OSs we must also include the "postscript name" in addition to the "full name". } }; (0, _localizedFonts.addLocalizedFont)(fontName, fonts); }); test('should add \'ja\' font rules when calling generateFontRules', function () { (0, _localizedFonts.generateFontRules)('ja'); var innerHTMLString = document.head.innerHTML.toString(); var expected1 = innerHTMLString.includes("id=\"localized-fonts\""); var expected2 = innerHTMLString.includes('Enact ja'); expect(expected1).toBeTruthy(); expect(expected2).toBeTruthy(); }); test('should add \'localized-fonts-override\' styles when calling generateFontOverrideRules', function () { (0, _localizedFonts.generateFontOverrideRules)('ur'); var innerHTMLString = document.head.innerHTML.toString(); var expected = innerHTMLString.includes("id=\"localized-fonts-override\""); expect(expected).toBeTruthy(); }); });