2016-08-03 15:27:03 -04:00
|
|
|
/* eslint-env qunit */
|
2019-08-07 16:05:41 -04:00
|
|
|
import {toLowerCase, toTitleCase, titleCaseEquals} from '../../../src/js/utils/string-cases.js';
|
2015-05-03 16:12:38 -07:00
|
|
|
|
2019-08-07 16:05:41 -04:00
|
|
|
QUnit.module('string-cases');
|
2015-08-03 15:19:36 -04:00
|
|
|
|
2019-08-07 16:05:41 -04:00
|
|
|
QUnit.test('toTitleCase should make a string start with an uppercase letter', function(assert) {
|
2016-08-03 15:27:03 -04:00
|
|
|
const foo = toTitleCase('bar');
|
|
|
|
|
2016-08-12 13:51:31 -04:00
|
|
|
assert.ok(foo === 'Bar');
|
2015-05-03 16:12:38 -07:00
|
|
|
});
|
2017-04-12 17:17:33 -04: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 16:05:41 -04:00
|
|
|
|
|
|
|
QUnit.test('toLowerCase should make a string start with a lowercase letter', function(assert) {
|
|
|
|
const foo = toLowerCase('BAR');
|
|
|
|
|
|
|
|
assert.ok(foo === 'bAR');
|
|
|
|
});
|