2016-08-03 21:27:03 +02:00
|
|
|
/* eslint-env qunit */
|
2017-04-12 23:17:33 +02:00
|
|
|
import toTitleCase, { titleCaseEquals } from '../../../src/js/utils/to-title-case.js';
|
2015-05-04 01:12:38 +02:00
|
|
|
|
2016-08-03 21:27:03 +02:00
|
|
|
QUnit.module('to-title-case');
|
2015-08-03 21:19:36 +02:00
|
|
|
|
2016-08-12 19:51:31 +02:00
|
|
|
QUnit.test('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');
|
|
|
|
});
|