-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Expand file tree
/
Copy pathdasherize_test.js
More file actions
36 lines (28 loc) · 1.33 KB
/
dasherize_test.js
File metadata and controls
36 lines (28 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { module, test } from 'qunit';
import { dasherize } from '@ember/engine/lib/strict-resolver/string';
module('strict-resolver | dasherize', function () {
test('dasherize normal string', function (assert) {
assert.deepEqual(dasherize('my favorite items'), 'my-favorite-items');
});
test('does nothing with dasherized string', function (assert) {
assert.deepEqual(dasherize('css-class-name'), 'css-class-name');
});
test('dasherize underscored string', function (assert) {
assert.deepEqual(dasherize('action_name'), 'action-name');
});
test('dasherize camelcased string', function (assert) {
assert.deepEqual(dasherize('innerHTML'), 'inner-html');
});
test('dasherize string that is the property name of Object.prototype', function (assert) {
assert.deepEqual(dasherize('toString'), 'to-string');
});
test('dasherize namespaced classified string', function (assert) {
assert.deepEqual(dasherize('PrivateDocs/OwnerInvoice'), 'private-docs/owner-invoice');
});
test('dasherize namespaced camelized string', function (assert) {
assert.deepEqual(dasherize('privateDocs/ownerInvoice'), 'private-docs/owner-invoice');
});
test('dasherize namespaced underscored string', function (assert) {
assert.deepEqual(dasherize('private_docs/owner_invoice'), 'private-docs/owner-invoice');
});
});