diff --git a/docs/ng-dev/classes/angularcontextnext.html b/docs/ng-dev/classes/angularcontextnext.html index 09876153..364206df 100644 --- a/docs/ng-dev/classes/angularcontextnext.html +++ b/docs/ng-dev/classes/angularcontextnext.html @@ -963,13 +963,13 @@ thrown away, so they cannot leak between tests.
  • Clearly separates initialization code from the test itself.
  • Gives control over the simulated date & time with a single line of code.
  • -
  • Automatically includes {@link HttpClientTestingModule} to stub network requests without additional setup.
  • -
  • Always verifies no unexpected http requests were made during a test.
  • -
  • Always discards periodic tasks and flushes pending timers at the end of each test to automatically avoid the error "X timer(s) still in the queue".
  • +
  • Automatically includes HttpClientTestingModule to stub network requests without additional setup.
  • +
  • Always verifies that no unexpected http requests were made.
  • +
  • Automatically discards periodic tasks and flushes pending timers at the end of each test to avoid the error "X timer(s) still in the queue".
  • Why does the class name end with "Next"? This replaces the old AngularContext, but it's a breaking change so this gives people some time to transition over. Eventually the old one will be removed and this will be renamed to AngularContext.

    -

    This example tests a simple service that uses HttpClient, and is tested by using AngularContextNext directly. More often AngularContextNext will be used a super class. See ComponentContextNext for more common use cases.

    +

    This example tests a simple service that uses HttpClient, and is tested by using AngularContextNext directly. More often AngularContextNext will be used as a super class. See ComponentContextNext for more common use cases.

    // This is the class we will test.
     @Injectable({ providedIn: 'root' })
     class MemoriesService {
    diff --git a/docs/ng-dev/classes/componentcontextnext.html b/docs/ng-dev/classes/componentcontextnext.html
    index 26e1ef55..f4aded77 100644
    --- a/docs/ng-dev/classes/componentcontextnext.html
    +++ b/docs/ng-dev/classes/componentcontextnext.html
    @@ -967,12 +967,14 @@
     		
    -

    A superclass to set up testing contexts for components. This is a foundation for an opinionated testing pattern, including everything described in AngularContextNext plus:

    +

    Provides the foundation for an opinionated pattern of component tests.

      +
    • Includes all features from AngularContextNext
    • Automatically creates your component at the beginning of run().
    • -
    • Wraps your component in a dynamically created parent component. (This sets up Angular to call ngOnChanges() in your tests the same way it does in production.)
    • -
    • Lets you use component harnesses (which are normally not usable within a fakeAsync test).
    • +
    • Sets up Angular to call ngOnChanges() like it would in production (this is not the case if you use the standard TestBed.createComponent() directly).
    • +
    • Wraps your component in a dynamically created parent that you can style however you like.
    • +
    • Lets you use component harnesses in the fakeAsync zone (which is normally a challenge).
    • Automatically disables animations.
    • Automatically integrates trimLeftoverStyles to speed up your test suite.
    @@ -1158,7 +1160,7 @@

    constructor

    @@ -1175,7 +1177,7 @@

    fixture

    fixture: ComponentFixture<unknown>
    @@ -1213,7 +1215,7 @@

    assignInputs

  • @@ -1234,7 +1236,7 @@

    assignWrapperStyles

  • @@ -1349,7 +1351,7 @@

    Protected init

    diff --git a/projects/ng-dev/src/lib/test-context/angular-context/angular-context-next.ts b/projects/ng-dev/src/lib/test-context/angular-context/angular-context-next.ts index 038b25b3..e6d5ae34 100644 --- a/projects/ng-dev/src/lib/test-context/angular-context/angular-context-next.ts +++ b/projects/ng-dev/src/lib/test-context/angular-context/angular-context-next.ts @@ -42,13 +42,13 @@ export function extendMetadata( * thrown away, so they cannot leak between tests. * - Clearly separates initialization code from the test itself. * - Gives control over the simulated date & time with a single line of code. - * - Automatically includes {@link HttpClientTestingModule} to stub network requests without additional setup. - * - Always verifies no unexpected http requests were made during a test. - * - Always discards periodic tasks and flushes pending timers at the end of each test to automatically avoid the error "X timer(s) still in the queue". + * - Automatically includes {@link https://angular.io/api/common/http/testing/HttpClientTestingModule|HttpClientTestingModule} to stub network requests without additional setup. + * - Always verifies that no unexpected http requests were made. + * - Automatically discards periodic tasks and flushes pending timers at the end of each test to avoid the error "X timer(s) still in the queue". * * Why does the class name end with "Next"? This replaces the old `AngularContext`, but it's a breaking change so this gives people some time to transition over. Eventually the old one will be removed and this will be renamed to `AngularContext`. * - * This example tests a simple service that uses HttpClient, and is tested by using `AngularContextNext` directly. More often `AngularContextNext` will be used a super class. See {@link ComponentContextNext} for more common use cases. + * This example tests a simple service that uses `HttpClient`, and is tested by using `AngularContextNext` directly. More often `AngularContextNext` will be used as a super class. See {@link ComponentContextNext} for more common use cases. * * ```ts * // This is the class we will test. diff --git a/projects/ng-dev/src/lib/test-context/component-context/component-context-next.ts b/projects/ng-dev/src/lib/test-context/component-context/component-context-next.ts index 20122a0a..7aebeb4d 100644 --- a/projects/ng-dev/src/lib/test-context/component-context/component-context-next.ts +++ b/projects/ng-dev/src/lib/test-context/component-context/component-context-next.ts @@ -16,11 +16,13 @@ import { } from './create-dynamic-wrapper'; /** - * A superclass to set up testing contexts for components. This is a foundation for an opinionated testing pattern, including everything described in {@link AngularContextNext} plus: + * Provides the foundation for an opinionated pattern for component tests. * + * - Includes all features from {@link AngularContextNext} * - Automatically creates your component at the beginning of `run()`. - * - Wraps your component in a dynamically created parent component. (This sets up Angular to call `ngOnChanges()` in your tests the same way it does in production.) - * - Lets you use {@link https://material.angular.io/cdk/test-harnesses/overview|component harnesses} (which are normally not usable within a `fakeAsync` test). + * - Sets up Angular to call `ngOnChanges()` like it would in production. This is not the case if you use the standard `TestBed.createComponent()` directly. + * - Wraps your component in a dynamically created parent that you can easily style however you like. + * - Lets you use {@link https://material.angular.io/cdk/test-harnesses/overview|component harnesses} in the `fakeAsync` zone, which is normally a challenge. * - Automatically disables animations. * - Automatically integrates {@link trimLeftoverStyles} to speed up your test suite. *