Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: update menu-bar visual tests to not capture full body #7841

Merged
merged 1 commit into from
Oct 8, 2024
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
39 changes: 26 additions & 13 deletions packages/menu-bar/test/visual/lumo/menu-bar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('menu-bar', () => {
describe('basic', () => {
beforeEach(async () => {
div = document.createElement('div');
div.style.display = 'inline-block';
div.style.padding = '10px';

element = fixtureSync('<vaadin-menu-bar></vaadin-menu-bar>', div);
Expand All @@ -38,29 +39,33 @@ describe('menu-bar', () => {
});

it('basic', async () => {
await visualDiff(document.body, `${dir}-basic`);
await visualDiff(div, `${dir}-basic`);
});

it('opened', async () => {
div.style.height = '150px';
element._buttons[1].click();
await nextRender(element);
await visualDiff(document.body, `${dir}-opened`);
await visualDiff(div, `${dir}-opened`);
});

it('reverse-collapse opened', async () => {
div.style.width = '250px';
element.style.width = '250px';
div.style.width = '350px';
div.style.height = '150px';
element.reverseCollapse = true;
await nextRender(element);
element._buttons[4].click();
const overlay = element._subMenu._overlayElement;
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-reverse-collapse-opened`);
await visualDiff(div, `${dir}-reverse-collapse-opened`);
});
});

describe('single button', () => {
beforeEach(async () => {
div = document.createElement('div');
div.style.display = 'inline-block';
div.style.padding = '10px';

element = fixtureSync('<vaadin-menu-bar></vaadin-menu-bar>', div);
Expand All @@ -70,13 +75,13 @@ describe('menu-bar', () => {
});

it('single button', async () => {
await visualDiff(document.body, `${dir}-single-button`);
await visualDiff(div, `${dir}-single-button`);
});

it('single overflow button', async () => {
element.items = [{ text: 'View' }, { text: 'Edit' }];
element.style.maxWidth = '100px';
await visualDiff(document.body, `${dir}-single-button-overflow`);
await visualDiff(div, `${dir}-single-button-overflow`);
});
});

Expand All @@ -93,6 +98,7 @@ describe('menu-bar', () => {

beforeEach(async () => {
div = document.createElement('div');
div.style.display = 'inline-block';
div.style.padding = '10px';

element = fixtureSync('<vaadin-menu-bar></vaadin-menu-bar>', div);
Expand All @@ -116,53 +122,59 @@ describe('menu-bar', () => {

it('primary', async () => {
div.style.width = '320px';
div.style.height = '150px';
element.setAttribute('theme', 'primary');
arrowDown(element._buttons[1]);
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-primary`);
await visualDiff(div, `${dir}-primary`);
});

it('secondary', async () => {
div.style.width = '320px';
div.style.height = '150px';
element.setAttribute('theme', 'secondary');
arrowDown(element._buttons[1]);
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-secondary`);
await visualDiff(div, `${dir}-secondary`);
});

it('tertiary', async () => {
div.style.width = '265px';
div.style.height = '150px';
element.setAttribute('theme', 'tertiary');
arrowDown(element._buttons[1]);
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-tertiary`);
await visualDiff(div, `${dir}-tertiary`);
});

it('tertiary-inline', async () => {
div.style.width = '200px';
div.style.height = '150px';
element.setAttribute('theme', 'tertiary-inline');
arrowDown(element._buttons[1]);
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-tertiary-inline`);
await visualDiff(div, `${dir}-tertiary-inline`);
});

it('small', async () => {
div.style.width = '265px';
div.style.height = '150px';
element.setAttribute('theme', 'small');
arrowDown(element._buttons[1]);
await oneEvent(overlay, 'vaadin-overlay-open');
await visualDiff(document.body, `${dir}-small`);
await visualDiff(div, `${dir}-small`);
});

it('end-aligned', async () => {
div.style.width = '600px';
element.setAttribute('theme', 'end-aligned');
await visualDiff(document.body, `${dir}-end-aligned`);
await visualDiff(div, `${dir}-end-aligned`);
});

it('end-aligned overflow button', async () => {
element.style.width = '100px';
element.setAttribute('theme', 'end-aligned');
await visualDiff(document.body, `${dir}-end-aligned-overflow-button`);
await visualDiff(div, `${dir}-end-aligned-overflow-button`);
});
});

Expand All @@ -175,6 +187,7 @@ describe('menu-bar', () => {

beforeEach(async () => {
div = document.createElement('div');
div.style.display = 'inline-block';
div.style.padding = '10px';

element = fixtureSync('<vaadin-menu-bar></vaadin-menu-bar>', div);
Expand Down
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading