Skip to content

Commit 38d916f

Browse files
committed
Enhance Accordion documentation: add target configurations and properties
1 parent 20265ac commit 38d916f

File tree

15 files changed

+617
-78
lines changed

15 files changed

+617
-78
lines changed
Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
11
# accordion
22

3-
Accordion
3+
`Exposed`
4+
5+
Accordion
6+
7+
Targets
8+
9+
- lightningCommunity__Default
10+
- lightningCommunity__Page
11+
12+
### lightningCommunity__Default
13+
14+
#### Properties
15+
16+
**contextUrlParam**
17+
18+
- Type: String
19+
- Required: false
20+
- Description: Optional - The name of the URL parameter that contains the context ID.
21+
22+
**previewContextId**
23+
24+
- Type: String
25+
- Required: false
26+
- Description: Optional - The ID of the context record to use when previewing the component in the builder.
27+
28+
**expr**
29+
30+
- Type: String
31+
- Required: true
32+
- Description: Formula expression to be evaluated.
33+
34+
**respectSharing**
35+
36+
- Type: Boolean
37+
- Required: false
38+
- Description: Whether to run the evaluation with or without sharing.
39+
40+
**autoCollapse**
41+
42+
- Type: Boolean
43+
- Required: false
44+
- Description: Whether to automatically collapse the accordion when a new section is expanded.
45+
46+
**flushStyle**
47+
48+
- Type: Boolean
49+
- Required: false
50+
- Description: Removes the background color and rounded borders from the accordion component.

examples/markdown/docs/miscellaneous/SampleException.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a sample exception.
44

5-
**Usage**
5+
**Usage**
66

77
You can use the exception the following way.
88
You can also take a look at [SampleClass](../samplegroup/SampleClass.md) to see how it is used.

examples/markdown/docs/miscellaneous/SampleInterface.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This is a sample interface
66

7-
**Mermaid**
7+
**Mermaid**
88

99
```mermaid
1010
graph TD
@@ -40,15 +40,15 @@ sampleInterface.sampleMethod();
4040

4141
This is a sample method
4242

43-
**Custom Tag**
43+
**Custom Tag**
4444

4545
This is a custom tag
4646

47-
**Another Custom Tag**
47+
**Another Custom Tag**
4848

4949
This is another custom tag
5050

51-
**Mermaid**
51+
**Mermaid**
5252

5353
graph TD
5454
A[SampleInterface] -->|extends| B[ParentInterface]

examples/markdown/docs/miscellaneous/Url.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ global Url(String spec)
9797

9898
Creates a new instance of the URL class by parsing the specified spec within the specified context.
9999

100-
**Usage**
100+
**Usage**
101101

102102
The new URL is created from the given context URL and the spec argument as described in RFC2396 "Uniform Resource Identifiers : Generic * Syntax" :
103103
```xml
@@ -176,7 +176,7 @@ The authority portion of the current URL.
176176

177177
Returns the URL of an entire request on a Salesforce instance.
178178

179-
**Usage**
179+
**Usage**
180180

181181
An example of a URL for an entire request is https://yourInstance.salesforce.com/apex/myVfPage.apexp.
182182

@@ -196,7 +196,7 @@ The URL of the entire request.
196196

197197
Returns the default port number of the protocol associated with the current URL.
198198

199-
**Usage**
199+
**Usage**
200200

201201
Returns -1 if the URL scheme or the stream protocol handler for the URL doesn't define a default port number.
202202

@@ -276,15 +276,15 @@ The host name of the current URL.
276276

277277
Returns the canonical URL for your org. For example, https://MyDomainName.my.salesforce.com.
278278

279-
**Usage**
279+
**Usage**
280280

281281
Use getOrgDomainUrl() to interact with Salesforce REST and SOAP APIs in Apex code. Get endpoints for User Interface API calls, for creating and customizing picklist value sets and custom fields, and more.
282282

283283
`getOrgDomainUrl()` can access the domain URL only for the org in which the Apex code is running.
284284

285285
You don't need a RemoteSiteSetting for your org to interact with the Salesforce APIs using domain URLs retrieved with this method.
286286

287-
**See Also**
287+
**See Also**
288288

289289
* [Lightning Aura Components Developer Guide: Making API Calls from Apex](https://developer.salesforce.com/docs/atlas.en-us.250.0.lightning.meta/lightning/apex_api_calls.htm)
290290

examples/markdown/docs/sample-enums/SampleEnum.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ This is a sample enum. This references [ReferencedEnum](../miscellaneous/Referen
66

77
This description has several lines
88

9-
**Some Custom**
9+
**Some Custom**
1010

1111
Test. I can also have a [ReferencedEnum](../miscellaneous/ReferencedEnum.md) here.
1212
And it can be multiline.
1313

14-
**Mermaid**
14+
**Mermaid**
1515

1616
graph TD
1717
A[SampleEnum] -->|references| B[ReferencedEnum]

src/core/markdown/__test__/generating-lwc-docs.spec.ts

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,81 @@ export default class RecordViewer extends LightningElement {
201201
});
202202
});
203203

204+
it('handles LWC with multiple targetConfigs and different properties', async () => {
205+
const lwcBuilder = new LwcBuilder()
206+
.withName('MultiConfigComponent')
207+
.withDescription('Component with multiple target configurations')
208+
.withTargets(['lightningCommunity__Default', 'lightning__AppPage', 'lightning__RecordPage'])
209+
.withProperty({
210+
name: 'communityTitle',
211+
type: 'String',
212+
required: true,
213+
label: 'Community Title',
214+
description: 'Title for community pages',
215+
target: 'lightningCommunity__Default',
216+
})
217+
.withProperty({
218+
name: 'appPageTitle',
219+
type: 'String',
220+
required: false,
221+
label: 'App Page Title',
222+
description: 'Title for app pages',
223+
target: 'lightning__AppPage',
224+
})
225+
.withProperty({
226+
name: 'recordId',
227+
type: 'String',
228+
required: true,
229+
label: 'Record ID',
230+
description: 'Record ID for record pages',
231+
target: 'lightning__RecordPage',
232+
})
233+
.withProperty({
234+
name: 'showDetails',
235+
type: 'Boolean',
236+
required: false,
237+
label: 'Show Details',
238+
description: 'Whether to show detailed information',
239+
target: 'lightning__RecordPage',
240+
default: 'false',
241+
});
242+
243+
const lwcBundle = unparsedLwcBundleFromRawString({
244+
jsContent: lwcBuilder.buildJs(),
245+
xmlContent: lwcBuilder.buildMetaXml(),
246+
filePath: 'force-app/main/default/lwc/multiConfigComponent/multiConfigComponent.js',
247+
name: 'MultiConfigComponent',
248+
});
249+
250+
const result = await generateDocs([lwcBundle])();
251+
252+
assertEither(result, (data) => {
253+
expect(data.docs).toHaveLength(1);
254+
expect(data).firstDocContains('MultiConfigComponent');
255+
expect(data).firstDocContains(' Targets');
256+
expect(data).firstDocContains('- lightningCommunity__Default');
257+
expect(data).firstDocContains('- lightning__AppPage');
258+
expect(data).firstDocContains('- lightning__RecordPage');
259+
expect(data).firstDocContains('lightningCommunity__Default');
260+
expect(data).firstDocContains(' Properties');
261+
expect(data).firstDocContains('**communityTitle**');
262+
expect(data).firstDocContains('- Type: String');
263+
expect(data).firstDocContains('- Required: true');
264+
expect(data).firstDocContains('lightning__AppPage');
265+
expect(data).firstDocContains('**appPageTitle**');
266+
expect(data).firstDocContains('- Type: String');
267+
expect(data).firstDocContains('- Required: false');
268+
expect(data).firstDocContains('lightning__RecordPage');
269+
expect(data).firstDocContains('**recordId**');
270+
expect(data).firstDocContains('- Type: String');
271+
expect(data).firstDocContains('- Required: true');
272+
expect(data).firstDocContains('**showDetails**');
273+
expect(data).firstDocContains('- Type: Boolean');
274+
expect(data).firstDocContains('- Required: false');
275+
expect(data).firstDocContains('- Description: Whether to show detailed information');
276+
});
277+
});
278+
204279
it('handles LWC that is not exposed', async () => {
205280
const lwcBuilder = new LwcBuilder()
206281
.withName('InternalComponent')
@@ -257,5 +332,47 @@ export default class MinimalComponent extends LightningElement {}`;
257332
expect(data.docs[0].source.type).toBe('lwc');
258333
});
259334
});
335+
336+
it('includes LWC metadata in final documentation output', async () => {
337+
const lwcBuilder = new LwcBuilder()
338+
.withName('MetadataComponent')
339+
.withDescription('Component with full metadata')
340+
.withIsExposed(true)
341+
.withMasterLabel('Metadata Test Component')
342+
.withTargets(['lightningCommunity__Default', 'lightning__AppPage'])
343+
.withProperty({
344+
name: 'recordId',
345+
type: 'String',
346+
required: true,
347+
label: 'Record ID',
348+
description: 'The ID of the record to display',
349+
});
350+
351+
const lwcBundle = unparsedLwcBundleFromRawString({
352+
jsContent: lwcBuilder.buildJs(),
353+
xmlContent: lwcBuilder.buildMetaXml(),
354+
filePath: 'force-app/main/default/lwc/metadataComponent/metadataComponent.js',
355+
name: 'MetadataComponent',
356+
});
357+
358+
const result = await generateDocs([lwcBundle])();
359+
360+
assertEither(result, (data) => {
361+
expect(data.docs).toHaveLength(1);
362+
363+
expect(data).firstDocContains('MetadataComponent');
364+
expect(data).firstDocContains('Component with full metadata');
365+
expect(data).firstDocContains('`Exposed`');
366+
expect(data).firstDocContains(' Targets');
367+
expect(data).firstDocContains('- lightningCommunity__Default');
368+
expect(data).firstDocContains('- lightning__AppPage');
369+
expect(data).firstDocContains('lightningCommunity__Default');
370+
expect(data).firstDocContains(' Properties');
371+
expect(data).firstDocContains('**recordId**');
372+
expect(data).firstDocContains('- Type: String');
373+
expect(data).firstDocContains('- Required: true');
374+
expect(data).firstDocContains('- Description: The ID of the record to display');
375+
});
376+
});
260377
});
261378
});

0 commit comments

Comments
 (0)