Skip to content

Commit ad9518d

Browse files
authored
fix(FormItem): display colons correctly in Firefox in rtl direction (#5385)
1 parent 062f551 commit ad9518d

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

packages/main/src/components/Form/Form.cy.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,29 +76,29 @@ describe('Form', () => {
7676
it('size S - labels and fields should cover full width', () => {
7777
cy.viewport(393, 852); // iPhone 14 Pro
7878
cy.mount(component);
79-
cy.findByText('item 1:').should('have.css', 'grid-column', '1 / span 12');
79+
cy.get('[ui5-label]').contains('item 1').should('have.css', 'grid-column', '1 / span 12');
8080
cy.findByTestId('formInput').parent().should('have.css', 'grid-column', '1 / span 12');
8181
});
8282

8383
it('size M - label should cover 2/12, field 10/12', () => {
8484
cy.viewport(834, 1194); // iPad Pro
8585
cy.mount(component);
86-
cy.findByText('item 1:').should('have.css', 'grid-column', '1 / span 2');
86+
cy.get('[ui5-label]').contains('item 1').should('have.css', 'grid-column', '1 / span 2');
8787
cy.findByTestId('formInput').parent().should('have.css', 'grid-column', '3 / span 10');
8888
});
8989

9090
it('size L - label should cover 1/3, field 2/3', () => {
9191
cy.viewport(1280, 1024);
9292
cy.mount(component);
93-
cy.findByText('item 1:').should('have.css', 'grid-column', '1 / span 4');
93+
cy.get('[ui5-label]').contains('item 1').should('have.css', 'grid-column', '1 / span 4');
9494
cy.findByTestId('formInput').parent().should('have.css', 'grid-column', '5 / span 8');
9595
});
9696

9797
it('size XL - render two columns with 1/3 and 2/3 each', () => {
9898
cy.viewport(1920, 1080);
9999
cy.mount(component);
100-
cy.findByText('item 1:').should('have.css', 'grid-column', '1 / span 4');
101-
cy.findByText('item 3:').should('have.css', 'grid-column', '13 / span 4');
100+
cy.get('[ui5-label]').contains('item 1').should('have.css', 'grid-column', '1 / span 4');
101+
cy.get('[ui5-label]').contains('item 3').should('have.css', 'grid-column', '13 / span 4');
102102
cy.findByTestId('formInput').parent().should('have.css', 'grid-column', '5 / span 8');
103103
cy.findByTestId('formInput2').parent().should('have.css', 'grid-column', '17 / span 8');
104104
});
@@ -117,8 +117,8 @@ describe('Form', () => {
117117
it('a11y labels', () => {
118118
cy.mount(component);
119119
for (let i = 1; i <= 3; i++) {
120-
cy.findByText(`item ${i}`).should('exist').should('not.be.visible');
121-
cy.findByText(`item ${i}:`).should('be.visible');
120+
cy.get('label').contains(`item ${i}`).should('exist').should('not.be.visible');
121+
cy.get('[ui5-label]').contains(`item ${i}`).should('be.visible');
122122
}
123123
// custom `Label`
124124
cy.findAllByText(`item 4`).eq(0).should('be.visible');
@@ -137,16 +137,16 @@ describe('Form', () => {
137137
</FormItem>
138138
</Form>
139139
);
140-
cy.findByText('Portal:').should('be.visible');
140+
cy.get('[ui5-label]').contains('Portal').should('be.visible');
141141
cy.findByTestId('notSupported').should('not.exist');
142142
});
143143

144144
it('conditionally render FormItems & FormGroups', () => {
145145
cy.mount(<ConditionRenderingExample />);
146-
cy.findByText('Item 2').should('not.exist');
146+
cy.findAllByText('Item 2').should('not.exist');
147147

148148
cy.findByText('Toggle Input').click();
149-
cy.findByText('Item 2').should('exist');
149+
cy.findAllByText('Item 2').should('exist');
150150
cy.findByTestId('2').should('be.visible').as('item2');
151151
cy.get('@item2').parent().should('have.css', 'grid-column-start', '17').and('have.css', 'grid-row-start', '1');
152152

packages/main/src/components/FormItem/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ function FormItemLabel({ label, style, className }: { label: ReactNode; style?:
8181
style={style}
8282
wrappingType={WrappingType.Normal}
8383
data-label-span={labelSpan}
84+
showColon={!!label}
8485
>
85-
{label ? `${label}:` : ''}
86+
{label}
8687
</Label>
8788
);
8889
}

0 commit comments

Comments
 (0)