Skip to content

Commit

Permalink
Remove metric check-in directive and enforce number values in check-i…
Browse files Browse the repository at this point in the history
…n metric value field
  • Loading branch information
RandomTannenbaum committed Jan 22, 2025
1 parent 0f8bba6 commit 13c7613
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 80 deletions.
4 changes: 1 addition & 3 deletions frontend/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ import { CheckInFormComponent } from './components/checkin/check-in-form/check-i
import { ApplicationTopBarComponent } from './components/application-top-bar/application-top-bar.component';
import { A11yModule } from '@angular/cdk/a11y';
import { CustomizationService } from './services/customization.service';
import { MetricCheckInDirective } from './components/checkin/check-in-form-metric/metric-check-in-directive';

function initOauthFactory(configService: ConfigService, oauthService: OAuthService) {
return async() => {
Expand Down Expand Up @@ -122,8 +121,7 @@ export const MY_FORMATS = {
CheckInHistoryDialogComponent,
CheckInFormMetricComponent,
CheckInFormOrdinalComponent,
CheckInFormComponent,
MetricCheckInDirective
CheckInFormComponent
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
[ngClass]="formInputCheck(dialogForm, 'value')"
formControlName="value"
id="value"
metricCheckIn
/>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,41 @@ describe('CheckInFormComponent', () => {
expect(component.generateUnitLabel())
.toEqual('');
}));


it.each([
[0,
true],
[150,
true],
[-23,
true],
[12.3,
true],
[-100.3,
true],
['123',
true],
['-123.4',
true],
['',
false],
['asdf',
false],
['a1',
false],
['1a',
false],
[null,
false]
])('should correctly validate value input', (value, validity) => {
component.dialogForm = new FormGroup({
value: new FormControl<string>('', [Validators.required])
});

component.ngOnInit();
component.dialogForm.setValue({ value: value });
expect(component.dialogForm.valid)
.toEqual(validity);
});
});

This file was deleted.

This file was deleted.

0 comments on commit 13c7613

Please sign in to comment.