diff --git a/src/document/transformOptions.ts b/src/document/transformOptions.ts index 00ec4e1..845ee5a 100644 --- a/src/document/transformOptions.ts +++ b/src/document/transformOptions.ts @@ -21,4 +21,5 @@ export interface TransformOptions { safeWrappingJsAttributes: string[], includeJsAttributes: string[], excludeJsAttributes: string[], + normalizeInlineSlotNames: boolean, } \ No newline at end of file diff --git a/src/document/transformer.ts b/src/document/transformer.ts index 7342b89..f2f1e3d 100644 --- a/src/document/transformer.ts +++ b/src/document/transformer.ts @@ -199,7 +199,8 @@ export class Transformer { ], includeJsAttributes: [ '^x-' - ] + ], + normalizeInlineSlotNames: true, } constructor(doc: BladeDocument) { @@ -615,9 +616,10 @@ export class Transformer { const open = ` { test('it formats simple component tags', async () => { @@ -58,6 +59,41 @@ suite('Component Tags', () => { ` ); }); + + test('it does not normalize closing tag name', async () => { + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeString(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + }); test('it normalizes names', async () => { assert.strictEqual( diff --git a/src/test/formatter_pint_component_tags.test.ts b/src/test/formatter_pint_component_tags.test.ts index f9e14ed..c153098 100644 --- a/src/test/formatter_pint_component_tags.test.ts +++ b/src/test/formatter_pint_component_tags.test.ts @@ -1,5 +1,6 @@ import assert from 'assert'; import { formatBladeStringWithPint } from '../formatting/prettier/utils.js'; +import { defaultSettings } from '../formatting/optionDiscovery.js'; suite('Pint Transformer: Component Tags', () => { test('pint: it formats simple component tags', async () => { @@ -58,6 +59,41 @@ suite('Pint Transformer: Component Tags', () => { ` ); }); + + test('pint: it does not normalize inline name pairs', async () => { + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + + assert.strictEqual( + (await formatBladeStringWithPint(` +

Content

+
`, {...defaultSettings, normalizeInlineSlotNames: false})).trim(), + ` +

Content

+
` + ); + }); test('pint: it normalizes names', async () => { assert.strictEqual(