Skip to content

Commit

Permalink
fix: position loader part correctly in RTL mode (#7566) (#7570)
Browse files Browse the repository at this point in the history
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
  • Loading branch information
vaadin-bot and web-padawan authored Jul 18, 2024
1 parent b46a0f1 commit c2bc68c
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
11 changes: 11 additions & 0 deletions packages/combo-box/test/visual/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ registerStyles(
}
`,
);

/* Stop loader animation */
registerStyles(
'vaadin-combo-box-overlay',
css`
:host([loading]) [part='loader'] {
animation: none;
opacity: 1;
}
`,
);
39 changes: 30 additions & 9 deletions packages/combo-box/test/visual/lumo/combo-box.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { fixtureSync } from '@vaadin/testing-helpers/dist/fixture.js';
import { fixtureSync, nextFrame } from '@vaadin/testing-helpers';
import { sendKeys } from '@web/test-runner-commands';
import { visualDiff } from '@web/test-runner-visual-regression';
import '../common.js';
Expand All @@ -19,14 +19,6 @@ describe('combo-box', () => {
await visualDiff(div, 'basic');
});

it('opened', async () => {
div.style.height = '200px';
div.style.width = '200px';
element.items = ['Foo', 'Bar', 'Baz'];
element.click();
await visualDiff(div, 'opened');
});

it('focus-ring', async () => {
await sendKeys({ press: 'Tab' });

Expand Down Expand Up @@ -98,4 +90,33 @@ describe('combo-box', () => {
element.appendChild(span);
await visualDiff(div, 'prefix');
});

['ltr', 'rtl'].forEach((dir) => {
describe(dir, () => {
before(() => {
document.documentElement.setAttribute('dir', dir);
});

after(() => {
document.documentElement.removeAttribute('dir');
});

beforeEach(() => {
div.style.height = '200px';
div.style.width = '200px';
element.items = ['Foo', 'Bar', 'Baz'];
element.open();
});

it(`${dir} opened`, async () => {
await visualDiff(div, `${dir}-opened`);
});

it(`${dir} loading`, async () => {
element.loading = true;
await nextFrame();
await visualDiff(div, `${dir}-loading`);
});
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 2 additions & 13 deletions packages/combo-box/theme/lumo/vaadin-combo-box-overlay-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,9 @@ const comboBoxLoader = css`
[part~='loader'] {
position: absolute;
z-index: 1;
left: var(--lumo-space-s);
right: var(--lumo-space-s);
inset-inline: var(--lumo-space-s);
top: var(--lumo-space-s);
margin-left: auto;
margin-inline-start: auto;
margin-inline-end: 0;
}
:host([dir='rtl']) [part~='loader'] {
left: auto;
margin-left: 0;
margin-right: auto;
margin-inline-start: 0;
margin-inline-end: auto;
margin-inline: auto 0;
}
`;

Expand Down

0 comments on commit c2bc68c

Please sign in to comment.