Skip to content

Commit 6353852

Browse files
MeAkibAndrewKushnir
authored andcommitted
docs: simplify example headers by showing only the file name
Removed redundant `src/app/` prefixes from <docs-code> headers to make examples cleaner and easier to read. The full path remains available via the `path` attribute, so the shortened headers improve clarity without losing context.
1 parent ff68806 commit 6353852

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

adev/src/content/guide/elements.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ There are a few options if you want to get correct types for your custom element
119119
Assume you create a `my-dialog` custom element based on the following component:
120120

121121
```ts
122-
123-
@Component(…)
122+
@Component(/* ... */)
124123
class MyDialog {
125124
content = input(string);
126125
}

adev/src/content/guide/routing/router-tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ ng generate component page-not-found
244244

245245
1. From your code editor, open the `page-not-found.component.html` file and replace its contents with the following HTML.
246246

247-
<docs-code header="page-not-found/page-not-found.component.html" path="adev/src/content/examples/router-tutorial/src/app/page-not-found/page-not-found.component.html"/>
247+
<docs-code header="page-not-found.component.html" path="adev/src/content/examples/router-tutorial/src/app/page-not-found/page-not-found.component.html"/>
248248

249249
1. Open the `app.routes.ts` file and add the following route to the routes list:
250250

adev/src/content/guide/routing/routing-with-urlmatcher.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ In addition to the default Angular application framework, you will also create a
3737

3838
1. In your code editor, locate the file, `profile.component.html` and replace the placeholder content with the following HTML.
3939

40-
<docs-code header="profile/profile.component.html" path="adev/src/content/examples/routing-with-urlmatcher/src/app/profile/profile.component.html"/>
40+
<docs-code header="profile.component.html" path="adev/src/content/examples/routing-with-urlmatcher/src/app/profile/profile.component.html"/>
4141

4242
1. In your code editor, locate the file, `app.component.html` and replace the placeholder content with the following HTML.
4343

adev/src/content/guide/testing/components-scenarios.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ For example:
341341

342342
HELPFUL: In order to make the `<canvas>` element Zone.js-aware in your app, you need to import the `zone-patch-canvas` patch \(either in `polyfills.ts` or in the specific file that uses `<canvas>`\):
343343

344-
<docs-code header="src/polyfills.ts or src/app/shared/canvas.component.ts" path="adev/src/content/examples/testing/src/app/shared/canvas.component.ts" region="import-canvas-patch"/>
344+
<docs-code header="polyfills.ts or canvas.component.ts" path="adev/src/content/examples/testing/src/app/shared/canvas.component.ts" region="import-canvas-patch"/>
345345

346346
### Async observables
347347

@@ -360,7 +360,7 @@ Your tests will reflect the real world more faithfully if you return an _asynchr
360360
The async observable was produced by an `asyncData` helper.
361361
The `asyncData` helper is a utility function that you'll have to write yourself, or copy this one from the sample code.
362362

363-
<docs-code header="testing/async-observable-helpers.ts" path="adev/src/content/examples/testing/src/testing/async-observable-helpers.ts" region="async-data"/>
363+
<docs-code header="async-observable-helpers.ts" path="adev/src/content/examples/testing/src/testing/async-observable-helpers.ts" region="async-data"/>
364364

365365
This helper's observable emits the `data` value in the next turn of the JavaScript engine.
366366

@@ -496,7 +496,7 @@ Clicking a button, an anchor, or an arbitrary HTML element is a common test task
496496

497497
Make that consistent and straightforward by encapsulating the _click-triggering_ process in a helper such as the following `click()` function:
498498

499-
<docs-code header="testing/index.ts (click helper)" path="adev/src/content/examples/testing/src/testing/index.ts" region="click-event"/>
499+
<docs-code header="index.ts (click helper)" path="adev/src/content/examples/testing/src/testing/index.ts" region="click-event"/>
500500

501501
The first parameter is the _element-to-click_.
502502
If you want, pass a custom event object as the second parameter.

adev/src/content/guide/testing/utility-apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Here are the most important static methods, in order of likely utility.
6767
| `overridePipe` | Replace metadata for the given pipe class, which could be nested deeply within an inner module. |
6868

6969
|
70-
`inject` | Retrieve a service from the current `TestBed` injector. The `inject` function is often adequate for this purpose. But `inject` throws an error if it can't provide the service. <br /> What if the service is optional? <br /> The `TestBed.inject()` method takes an optional second parameter, the object to return if Angular can't find the provider \(`null` in this example\): <docs-code header="app/demo/demo.testbed.spec.ts" path="adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" region="testbed-get-w-null"/> After calling `TestBed.inject`, the `TestBed` configuration is frozen for the duration of the current spec. |
70+
`inject` | Retrieve a service from the current `TestBed` injector. The `inject` function is often adequate for this purpose. But `inject` throws an error if it can't provide the service. <br /> What if the service is optional? <br /> The `TestBed.inject()` method takes an optional second parameter, the object to return if Angular can't find the provider \(`null` in this example\): <docs-code header="demo.testbed.spec.ts" path="adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" region="testbed-get-w-null"/> After calling `TestBed.inject`, the `TestBed` configuration is frozen for the duration of the current spec. |
7171
|
7272
`initTestEnvironment` | Initialize the testing environment for the entire test run. <br /> The testing shims call it for you so there is rarely a reason for you to call it yourself. <br /> Call this method _exactly once_. To change this default in the middle of a test run, call `resetTestEnvironment` first. <br /> Specify the Angular compiler factory, a `PlatformRef`, and a default Angular testing module. Alternatives for non-browser platforms are available in the general form `@angular/platform-<platform_name>/testing/<platform_name>`. |
7373
| `resetTestEnvironment` | Reset the initial test environment, including the default testing module. |

0 commit comments

Comments
 (0)