Skip to content

Commit 81b37c0

Browse files
committed
Fix camel casing
1 parent 5db7919 commit 81b37c0

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

packages/host/app/components/operator-mode/create-file-modal.gts

+6-5
Original file line numberDiff line numberDiff line change
@@ -726,16 +726,17 @@ export class ${className} extends ${exportName} {
726726

727727
function convertToClassName(input) {
728728
// \p{L}: a letter
729-
let invalidLeadingCharactersRemoved = input.replace(/^[^\p{L}_$]+/u, '');
729+
let invalidLeadingCharactersRemoved = camelCase(
730+
input.replace(/^[^\p{L}_$]+/u, ''),
731+
{ pascalCase: true },
732+
);
730733

731-
// \p{N}: a number
732-
let invalidCharactersRemoved = invalidLeadingCharactersRemoved.replace(
734+
let className = invalidLeadingCharactersRemoved.replace(
735+
// \p{N}: a number
733736
/[^\p{L}\p{N}_$]+/gu,
734737
'',
735738
);
736739

737-
let className = camelCase(invalidCharactersRemoved, { pascalCase: true });
738-
739740
// make sure we don't collide with a javascript built-in object
740741
if (typeof (globalThis as any)[className] !== 'undefined') {
741742
className = `${className}0`;

packages/host/tests/acceptance/code-submode/create-file-test.gts

+3-3
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ module('Acceptance | code submode | create-file tests', function (hooks) {
561561
import { CardDef } from 'https://cardstack.com/base/card-api';
562562
import { Component } from 'https://cardstack.com/base/card-api';
563563
export class TrèsTestCard extends CardDef {
564-
static displayName = "Très Test Card 😀";
564+
static displayName = "Très test card 😀";
565565
566566
/*
567567
static isolated = class Isolated extends Component<typeof this> {
@@ -587,7 +587,7 @@ export class TrèsTestCard extends CardDef {
587587
assert
588588
.dom('[data-test-create-definition]')
589589
.isDisabled('create button is disabled');
590-
await fillIn('[data-test-display-name-field]', 'Très Test Card 😀');
590+
await fillIn('[data-test-display-name-field]', 'Très test card 😀');
591591
assert
592592
.dom(`[data-test-inherits-from-field] [data-test-boxel-field-label]`)
593593
.hasText('Inherits From');
@@ -614,7 +614,7 @@ export class TrèsTestCard extends CardDef {
614614
'monaco displays the new definition',
615615
);
616616

617-
await waitFor('[data-test-card-schema="Très Test Card 😀"]');
617+
await waitFor('[data-test-card-schema="Très test card 😀"]');
618618
assert.dom('[data-test-current-module-name]').hasText('très-test-card.gts');
619619
assert
620620
.dom('[data-test-card-url-bar-input]')

0 commit comments

Comments
 (0)