UNPKG

@enact/i18n

Version:

Internationalization support for Enact using iLib

50 lines (49 loc) 1.81 kB
"use strict"; var _util = require("../util"); describe('util', function () { describe('isRtlText', function () { test('should return `true` for a RTL text', function () { var expected = true; var actual = (0, _util.isRtlText)('نحن اسم المواضيع بعد الأحجار الكريمة'); expect(actual).toEqual(expected); }); test('should return `false` for a LTR text', function () { var expected = false; var actual = (0, _util.isRtlText)('Hello'); expect(actual).toEqual(expected); }); test('should return `false` for a non string value', function () { var expected = false; var actual = (0, _util.isRtlText)(123); expect(actual).toEqual(expected); }); }); describe('toCapitalized', function () { test('should capitalize the first letter of given string', function () { var expected = 'Hello'; var actual = (0, _util.toCapitalized)('hello'); expect(actual).toEqual(expected); }); }); describe('toLowerCase', function () { test('should convert a string to lower case', function () { var expected = 'hello'; var actual = (0, _util.toLowerCase)('HELLO'); expect(actual).toEqual(expected); }); }); describe('toUpperCase', function () { test('should convert a string to upper case', function () { var expected = 'HELLO'; var actual = (0, _util.toUpperCase)('hello'); expect(actual).toEqual(expected); }); }); describe('toWordCase', function () { test('should capitalize every word in a string', function () { var expected = 'The Quick Brown Fox Jumped Over The Lazy Dog.'; var actual = (0, _util.toWordCase)('the quick brown fox jumped over the lazy dog.'); expect(actual).toEqual(expected); }); }); });