Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/main/cypress/specs/DatePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1937,3 +1937,14 @@ describe("Accessibility", () => {
.should("have.text", DESCRIPTION);
});
});

describe("CSS Parts", () => {
it("DatePicker exposes input CSS part through DateTimeInput", () => {
cy.mount(<DatePicker />);

cy.get<DatePicker>("[ui5-date-picker]")
.shadow()
.find("[ui5-datetime-input]")
.should("have.attr", "part", "input");
});
});
11 changes: 11 additions & 0 deletions packages/main/cypress/specs/TimePicker.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -543,4 +543,15 @@ describe("Validation inside a form", () => {
cy.get("#timePicker:invalid")
.should("not.exist", "Timepicker with correct formatted value should not have :invalid CSS class");
});
});

describe("CSS Parts", () => {
it("TimePicker exposes input CSS part through DateTimeInput", () => {
cy.mount(<TimePicker />);

cy.get<TimePicker>("[ui5-time-picker]")
.shadow()
.find("[ui5-datetime-input]")
.should("have.attr", "part", "input");
});
});
1 change: 1 addition & 0 deletions packages/main/src/DatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ type Picker = "day" | "month" | "year";
* @constructor
* @extends DateComponentBase
* @public
* @csspart input - Used to style the input element. This part is forwarded to the underlying ui5-input element.
*/

@customElement({
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/DatePickerInputTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export default function DatePickerInputTemplate(this: DatePicker) {
data-sap-focus-ref
id={`${this._id}-inner`}
class="ui5-date-picker-input"
part="input"
placeholder={this._placeholder}
type={this.type}
value={this.displayValue}
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/TimePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ type TimePickerInputEventDetail = TimePickerChangeInputEventDetail;
* @extends UI5Element
* @public
* @since 1.0.0-rc.6
* @csspart input - Used to style the input element. This part is forwarded to the underlying ui5-input element.
*/
@customElement({
tag: "ui5-time-picker",
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/TimePickerTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function TimePickerTemplate(this: TimePicker) {
data-sap-focus-ref
id={`${this._id}-inner`}
class="ui5-time-picker-input"
part="input"
value={this.value}
placeholder={this._placeholder}
disabled={this.disabled}
Expand Down
2 changes: 2 additions & 0 deletions packages/main/test/pages/styles/DatePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
background-color: var(--sapBackgroundColor);
}

#dp6::part(input) {
text-align: right;

form ui5-date-picker:invalid {
outline: 2px solid var(--sapNegativeColor);
Expand Down
3 changes: 3 additions & 0 deletions packages/main/test/pages/styles/DateRangePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
background-color: var(--sapBackgroundColor);
}

#drpLabel::part(input) {
text-align: right;
}
form ui5-daterange-picker:invalid {
outline: 2px solid var(--sapNegativeColor);
}
3 changes: 3 additions & 0 deletions packages/main/test/pages/styles/TimePicker.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ html,body {
width: 100%
}

#tpLabel::part(input) {
text-align: right;
}
form ui5-time-picker:invalid {
outline: 2px solid var(--sapNegativeColor);
}
Loading