diff --git a/packages/form-layout/test/form-layout.common.js b/packages/form-layout/test/form-layout.common.js
index 280ab3056a..ca4f375f14 100644
--- a/packages/form-layout/test/form-layout.common.js
+++ b/packages/form-layout/test/form-layout.common.js
@@ -171,80 +171,6 @@ describe('form layout', () => {
});
});
- describe('container overflow', () => {
- let container, layout;
-
- beforeEach(() => {
- container = fixtureSync(`
-
-
- 1 start
- 2 mid
- 3 end
-
- invisible
- 4 start
- invisible
-
- 5 start
- 6 end
- 7 start
- 8 end
- 9 start to end
-
-
- `);
- layout = container.firstElementChild;
- });
-
- it('should not overflow containers horizontally', () => {
- expect(container.scrollWidth).to.equal(container.clientWidth);
- });
-
- it('should maintain the colspan value before the line break', () => {
- const secondItemRect = layout.children[1].getBoundingClientRect();
- const fourthItemRect = layout.children[5].getBoundingClientRect();
- expect(secondItemRect.right).to.be.closeTo(fourthItemRect.right, 0.5);
- });
-
- describe('no spacing on edges', () => {
- it('should not have spacing on the left edge', () => {
- const containerRect = container.getBoundingClientRect();
- Array.from(layout.querySelectorAll('[at-start]')).forEach((child) => {
- expect(child.getBoundingClientRect().left).to.be.closeTo(containerRect.left, 0.5);
- });
- });
-
- it('should not have spacing on the right edge', () => {
- const containerRect = container.getBoundingClientRect();
- Array.from(layout.querySelectorAll('[at-end]')).forEach((child) => {
- expect(child.getBoundingClientRect().right).to.be.closeTo(containerRect.right, 0.5);
- });
- });
- });
-
- describe('no spacing on edges (rtl)', () => {
- beforeEach(async () => {
- container.dir = 'rtl';
- await aTimeout(100);
- });
-
- it('should not have spacing on the right edge', () => {
- const containerRect = container.getBoundingClientRect();
- Array.from(layout.querySelectorAll('[at-start]')).forEach((child) => {
- expect(child.getBoundingClientRect().right).to.be.closeTo(containerRect.right, 0.5);
- });
- });
-
- it('should not have spacing on the left edge', () => {
- const containerRect = container.getBoundingClientRect();
- Array.from(layout.querySelectorAll('[at-end]')).forEach((child) => {
- expect(child.getBoundingClientRect().left).to.be.closeTo(containerRect.left, 0.5);
- });
- });
- });
- });
-
describe('responsiveSteps property', () => {
let layout;
diff --git a/packages/form-layout/test/visual/lumo/form-layout.test.js b/packages/form-layout/test/visual/lumo/form-layout.test.js
index 17cdd1223b..802931b951 100644
--- a/packages/form-layout/test/visual/lumo/form-layout.test.js
+++ b/packages/form-layout/test/visual/lumo/form-layout.test.js
@@ -246,4 +246,56 @@ describe('form-layout', () => {
await visualDiff(element, 'required-indicator-labels-on-top');
});
});
+
+ ['ltr', 'rtl'].forEach((dir) => {
+ describe(dir, () => {
+ before(() => {
+ document.documentElement.setAttribute('dir', dir);
+ });
+
+ after(() => {
+ document.documentElement.removeAttribute('dir');
+ });
+
+ describe('container overflow', () => {
+ beforeEach(() => {
+ element = fixtureSync(`
+
+
+
+
+
+ 1/3
+ 1/3
+ 1/3
+
+ hidden
+ 2/3
+ hidden
+
+ 1/3
+ 2/3
+ 2/3
+ 1/3
+ 3/3
+
+
+
+ `);
+ });
+
+ it('basic', async () => {
+ await visualDiff(element, `${dir}-container-overflow`);
+ });
+ });
+ });
+ });
});
diff --git a/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/ltr-container-overflow.png b/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/ltr-container-overflow.png
new file mode 100644
index 0000000000..b2fd80d585
Binary files /dev/null and b/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/ltr-container-overflow.png differ
diff --git a/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/rtl-container-overflow.png b/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/rtl-container-overflow.png
new file mode 100644
index 0000000000..5c81106f0b
Binary files /dev/null and b/packages/form-layout/test/visual/lumo/screenshots/form-layout/baseline/rtl-container-overflow.png differ