2016-08-03 21:27:03 +02:00
|
|
|
/* eslint-env qunit */
|
2019-08-07 22:05:41 +02:00
|
|
|
import {toLowerCase, toTitleCase, titleCaseEquals} from '../../../src/js/utils/string-cases.js';
|
2015-05-04 01:12:38 +02:00
|
|
|
|
2019-08-07 22:05:41 +02:00
|
|
|
QUnit.module('string-cases');
|
2015-08-03 21:19:36 +02:00
|
|
|
|
2019-08-07 22:05:41 +02:00
|
|
|
QUnit.test('toTitleCase should make a string start with an uppercase letter', function(assert) {
|
2016-08-03 21:27:03 +02:00
|
|
|
const foo = toTitleCase('bar');
|
|
|
|
|
2016-08-12 19:51:31 +02:00
|
|
|
assert.ok(foo === 'Bar');
|
2015-05-04 01:12:38 +02:00
|
|
|
});
|
2017-04-12 23:17:33 +02:00
|
|
|
|
|
|
|
QUnit.test('titleCaseEquals compares whether the TitleCase of two strings is equal', function(assert) {
|
|
|
|
assert.ok(titleCaseEquals('foo', 'foo'), 'foo equals foo');
|
|
|
|
assert.ok(titleCaseEquals('foo', 'Foo'), 'foo equals Foo');
|
|
|
|
assert.ok(titleCaseEquals('Foo', 'foo'), 'Foo equals foo');
|
|
|
|
assert.ok(titleCaseEquals('Foo', 'Foo'), 'Foo equals Foo');
|
|
|
|
|
|
|
|
assert.ok(titleCaseEquals('fooBar', 'fooBar'), 'fooBar equals fooBar');
|
|
|
|
assert.notOk(titleCaseEquals('fooBAR', 'fooBar'), 'fooBAR does not equal fooBar');
|
|
|
|
assert.notOk(titleCaseEquals('foobar', 'fooBar'), 'foobar does not equal fooBar');
|
|
|
|
assert.notOk(titleCaseEquals('fooBar', 'FOOBAR'), 'fooBar does not equal fooBAR');
|
|
|
|
});
|
2019-08-07 22:05:41 +02:00
|
|
|
|
|
|
|
QUnit.test('toLowerCase should make a string start with a lowercase letter', function(assert) {
|
|
|
|
const foo = toLowerCase('BAR');
|
|
|
|
|
|
|
|
assert.ok(foo === 'bAR');
|
|
|
|
});
|