Skip to content

Commit

Permalink
fix: fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
jeripeierSBB committed Nov 21, 2024
1 parent 8551db6 commit 6a5623b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/elements/time-input/time-input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe(`sbb-time-input`, () => {
await waitForLitRender(element);
expect(input.value).to.be.equal('15:00');

const dateCalculated = element.valueAsDate.getTime();
const dateCalculated = element.valueAsDate!.getTime();
expect(new Date(dateCalculated).getHours()).to.be.equal(date.getHours());
expect(new Date(dateCalculated).getMinutes()).to.be.equal(date.getMinutes());
});
Expand Down
6 changes: 3 additions & 3 deletions src/elements/time-input/time-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ class SbbTimeInputElement extends LitElement {
}
private _input: string | HTMLElement | null = null;

@state() private accessor _inputElement: HTMLInputElement | null = null;

/** Formats the current input's value as date. */
@property({ attribute: false })
public set valueAsDate(date: SbbDateLike) {
public set valueAsDate(date: SbbDateLike | null) {
if (!date || !this._inputElement) {
return;
}

Check warning on line 56 in src/elements/time-input/time-input.ts

View check run for this annotation

Codecov / codecov/patch

src/elements/time-input/time-input.ts#L55-L56

Added lines #L55 - L56 were not covered by tests
Expand All @@ -67,8 +69,6 @@ class SbbTimeInputElement extends LitElement {
return this._formatValueAsDate(this._parseInput(this._inputElement?.value)) ?? null;
}

@state() private _inputElement: HTMLInputElement | null;

/**
* @deprecated only used for React. Will probably be removed once React 19 is available.
*/
Expand Down

0 comments on commit 6a5623b

Please sign in to comment.