Skip to content

Commit

Permalink
feat(ng-core): Rename FormControlSuperclass to `FormComponentSuperc…
Browse files Browse the repository at this point in the history
…lass`, to better match Angular terminology (where a "FormControl" is not a component)

BREAKING CHANGE: Rename all references of `FormControlSuperclass` to `FormComponentSuperclass`
  • Loading branch information
ersimont committed Sep 14, 2021
1 parent 1c9a715 commit 481908d
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions projects/integration/src/app/api-tests/ng-core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { keys } from '@s-libs/micro-dash';
import * as ngCore from '@s-libs/ng-core';
import {
DirectiveSuperclass,
FormControlSuperclass,
FormComponentSuperclass,
InjectableSuperclass,
mixInInjectableSuperclass,
provideValueAccessor,
Expand All @@ -34,8 +34,8 @@ describe('ng-core', () => {
expect(DirectiveSuperclass).toBeDefined();
});

it('has FormControlSuperclass', () => {
expect(FormControlSuperclass).toBeDefined();
it('has FormComponentSuperclass', () => {
expect(FormComponentSuperclass).toBeDefined();
});

it('has InjectableSuperclass', () => {
Expand Down Expand Up @@ -301,7 +301,7 @@ describe('ng-core', () => {
});

it('knows where to find micro-dash', () => {
// FormControlSuperclass uses micro-dash. This is one of its tests
// FormComponentSuperclass uses micro-dash. This is one of its tests

@Component({
template: `
Expand Down Expand Up @@ -331,7 +331,7 @@ describe('ng-core', () => {
providers: [provideValueAccessor(CounterComponent)],
changeDetection: ChangeDetectionStrategy.OnPush,
})
class CounterComponent extends FormControlSuperclass<number> {
class CounterComponent extends FormComponentSuperclass<number> {
counter = 0;

constructor(injector: Injector) {
Expand Down
2 changes: 1 addition & 1 deletion projects/micro-dash/src/lib/collection/partition.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ describe('partition', () => {
// stolen from https://github.com/lodash/lodash
//

var array = [1, 0, 1];
const array = [1, 0, 1];

it('should split elements into two groups by `predicate`', () => {
expect(partition([], identity)).toEqual([[], []]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { ComponentContext } from '@s-libs/ng-dev';
import { click, find, findButton } from '../test-helpers';
import { DirectiveSuperclass } from './directive-superclass';
import {
FormControlSuperclass,
FormComponentSuperclass,
provideValueAccessor,
} from './form-control-superclass';
} from './form-component-superclass';
import { InjectableSuperclass } from './injectable-superclass';

@Component({
Expand All @@ -35,7 +35,7 @@ class TestComponent {
providers: [provideValueAccessor(CounterComponent)],
changeDetection: ChangeDetectionStrategy.OnPush,
})
class CounterComponent extends FormControlSuperclass<number> {
class CounterComponent extends FormComponentSuperclass<number> {
counter = 0;

handleIncomingValue(value: number): void {
Expand All @@ -48,7 +48,7 @@ class CounterComponent extends FormControlSuperclass<number> {
}
}

describe('FormControlSuperclass', () => {
describe('FormComponentSuperclass', () => {
let ctx: ComponentContext<TestComponent>;
beforeEach(() => {
ctx = new ComponentContext(TestComponent, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function provideValueAccessor(type: Type<any>): Provider {
* `,
* providers: [provideValueAccessor(CounterComponent)],
* })
* class CounterComponent extends FormControlSuperclass<number> {
* class CounterComponent extends FormComponentSuperclass<number> {
* counter = 0;
*
* handleIncomingValue(value: number) {
Expand All @@ -46,7 +46,7 @@ export function provideValueAccessor(type: Type<any>): Provider {
* }
* ```
*/
export abstract class FormControlSuperclass<T>
export abstract class FormComponentSuperclass<T>
extends DirectiveSuperclass
implements ControlValueAccessor
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import { filter, map } from 'rxjs/operators';
import { click, find, findButton, setValue } from '../test-helpers';
import { DirectiveSuperclass } from './directive-superclass';
import {
FormControlSuperclass,
FormComponentSuperclass,
provideValueAccessor,
} from './form-control-superclass';
} from './form-component-superclass';
import { InjectableSuperclass } from './injectable-superclass';
import { WrappedFormControlSuperclass } from './wrapped-form-control-superclass';

Expand Down Expand Up @@ -267,7 +267,7 @@ describe('WrappedFormControlSuperclass tests using an old style fixture', () =>
).componentInstance;
expect(component instanceof InjectableSuperclass).toBe(true);
expect(component instanceof DirectiveSuperclass).toBe(true);
expect(component instanceof FormControlSuperclass).toBe(true);
expect(component instanceof FormComponentSuperclass).toBe(true);
});
});
});
4 changes: 2 additions & 2 deletions projects/ng-core/src/lib/wrapped-form-control-superclass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormControl } from '@angular/forms';
import { wrapMethod } from '@s-libs/js-core';
import { Observable, Subject } from 'rxjs';
import { map } from 'rxjs/operators';
import { FormControlSuperclass } from './form-control-superclass';
import { FormComponentSuperclass } from './form-component-superclass';

/**
* Extend this when creating a form control that simply wraps an existing form control, to reduce a lot of boilerplate. **Warning:** You _must_ include a constructor in your subclass.
Expand Down Expand Up @@ -50,7 +50,7 @@ import { FormControlSuperclass } from './form-control-superclass';
export abstract class WrappedFormControlSuperclass<
OuterType,
InnerType = OuterType,
> extends FormControlSuperclass<OuterType> {
> extends FormComponentSuperclass<OuterType> {
/** Bind this to your inner form control to make all the magic happen. */
formControl = new FormControl();

Expand Down
4 changes: 2 additions & 2 deletions projects/ng-core/src/public-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

export { DirectiveSuperclass } from './lib/directive-superclass';
export {
FormControlSuperclass,
FormComponentSuperclass,
provideValueAccessor,
} from './lib/form-control-superclass';
} from './lib/form-component-superclass';
export {
InjectableSuperclass,
mixInInjectableSuperclass,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FormControlSuperclass } from '../public-api';
import { FormComponentSuperclass } from '../public-api';

class TestSubclass extends FormControlSuperclass<Date> {
class TestSubclass extends FormComponentSuperclass<Date> {
handleIncomingValue(_value: Date): void {}
}

Expand Down

0 comments on commit 481908d

Please sign in to comment.