Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into merge-polymer-and-lit…
Browse files Browse the repository at this point in the history
…-tests
  • Loading branch information
vursen committed Jan 31, 2025
2 parents 7ac5f75 + 100f4d1 commit 21cc830
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 76 deletions.
1 change: 1 addition & 0 deletions packages/a11y-base/src/list-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ListMixin = (superClass) =>
type: Number,
reflectToAttribute: true,
notify: true,
sync: true,
},

/**
Expand Down
2 changes: 0 additions & 2 deletions packages/a11y-base/test/list-mixin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,6 @@ const runTests = (defineHelper, baseMixin) => {

it('should reset previously selected item when listbox and items are disabled', async () => {
list.selected = 3;
await nextUpdate(list);
expect(items[3].selected).to.be.true;

list.disabled = true;
Expand All @@ -788,7 +787,6 @@ const runTests = (defineHelper, baseMixin) => {

it('should restore previously selected item when listbox becomes re-enabled', async () => {
list.selected = 3;
await nextUpdate(list);

list.disabled = true;
items.forEach((item) => {
Expand Down
74 changes: 0 additions & 74 deletions packages/form-layout/test/form-layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,80 +174,6 @@ describe('form layout', () => {
});
});

describe('container overflow', () => {
let container, layout;

beforeEach(() => {
container = fixtureSync(`
<div style="width: 300px; overflow: auto;">
<vaadin-form-layout responsive-steps='[{"columns": 3}]'>
<div at-start>1 start</div>
<div>2 mid</div>
<div at-end>3 end</div>
<br>
<div style="display: none;">invisible</div>
<div at-start colspan="2">4 start</div>
<div style="display: none;">invisible</div>
<br>
<div at-start>5 start</div>
<div colspan="2" at-end>6 end</div>
<div colspan="2" at-start>7 start</div>
<div at-end>8 end</div>
<div colspan="3" at-start at-end>9 start to end</div>
</vaadin-form-layout>
</div>
`);
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;

Expand Down
52 changes: 52 additions & 0 deletions packages/form-layout/test/visual/lumo/form-layout.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(`
<div style="display: inline-block; padding: 10px">
<style>
vaadin-form-layout > div:nth-child(even) {
background: var(--lumo-contrast-10pct);
}
vaadin-form-layout > div:nth-child(odd) {
background: var(--lumo-contrast-50pct);
}
</style>
<div style="width: 300px; overflow: auto; border: 1px solid;">
<vaadin-form-layout responsive-steps='[{"columns": 3}]'>
<div>1/3</div>
<div>1/3</div>
<div>1/3</div>
<br>
<div style="display: none;">hidden</div>
<div colspan="2">2/3</div>
<div style="display: none;">hidden</div>
<br>
<div>1/3</div>
<div colspan="2">2/3</div>
<div colspan="2">2/3</div>
<div>1/3</div>
<div colspan="3">3/3</div>
</vaadin-form-layout>
</div>
</div>
`);
});

it('basic', async () => {
await visualDiff(element, `${dir}-container-overflow`);
});
});
});
});
});
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.

0 comments on commit 21cc830

Please sign in to comment.