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: stabilize a couple of tests #2525

Merged
merged 9 commits into from
Mar 27, 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
20 changes: 0 additions & 20 deletions src/components/accordion/__snapshots__/accordion.spec.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,3 @@ snapshots["sbb-accordion A11y tree Firefox"] =
`;
/* end snapshot sbb-accordion A11y tree Firefox */

snapshots["sbb-accordion A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "button",
"name": "Header 1"
},
{
"role": "button",
"name": "Header 2"
}
]
}
</p>
`;
/* end snapshot sbb-accordion A11y tree Safari */

2 changes: 0 additions & 2 deletions src/components/accordion/accordion.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';

import { waitForLitRender } from '../core/testing';
import { fixture, testA11yTreeSnapshot } from '../core/testing/private';

import type { SbbAccordionElement } from './accordion';
Expand All @@ -24,7 +23,6 @@ describe(`sbb-accordion`, () => {
</sbb-expansion-panel>
</sbb-accordion>
`);
await waitForLitRender(element);
});

it('renders - Dom', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ snapshots["sbb-action-group renders renders - ShadowDom"] =
`;
/* end snapshot sbb-action-group renders renders - ShadowDom */

snapshots["sbb-action-group renders A11y tree Chrome"] =
snapshots["sbb-action-group renders A11y tree Chrome"] =
`<p>
{
"role": "WebArea",
Expand Down Expand Up @@ -101,35 +101,3 @@ snapshots["sbb-action-group renders A11y tree Firefox"] =
`;
/* end snapshot sbb-action-group renders A11y tree Firefox */

snapshots["sbb-action-group renders A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "button",
"name": "Button"
},
{
"role": "link",
"name": "",
"children": [
{
"role": "link",
"name": "Link",
"children": [
{
"role": "text",
"name": "Link"
}
]
}
]
}
]
}
</p>
`;
/* end snapshot sbb-action-group renders A11y tree Safari */

1 change: 0 additions & 1 deletion src/components/action-group/action-group.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe(`sbb-action-group with ${fixture.name}`, () => {
`,
{ modules: ['./action-group.ts', '../button/index.ts', '../link/index.ts'] },
);
await waitForLitRender(element);
});

it('renders', async () => {
Expand Down
2 changes: 0 additions & 2 deletions src/components/action-group/action-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';

import type { SbbSecondaryButtonElement } from '../button';
import { waitForLitRender } from '../core/testing';
import { fixture, testA11yTreeSnapshot } from '../core/testing/private';

import type { SbbActionGroupElement } from './action-group';
Expand All @@ -26,7 +25,6 @@ describe(`sbb-action-group`, () => {
</sbb-block-link>
</sbb-action-group>
`);
await waitForLitRender(element);
});

it('renders - Dom', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,49 +113,3 @@ snapshots["sbb-alert-group should render A11y tree Firefox"] =
`;
/* end snapshot sbb-alert-group should render A11y tree Firefox */

snapshots["sbb-alert-group should render A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "heading",
"name": "Disruptions",
"level": 3
},
{
"role": "heading",
"name": "Interruption between Genève and Lausanne",
"level": 3
},
{
"role": "text",
"name": "The rail traffic between Allaman and Morges is interrupted. All trains are cancelled."
},
{
"role": "link",
"name": "",
"children": [
{
"role": "link",
"name": "Find out more",
"children": [
{
"role": "text",
"name": "Find out more"
}
]
}
]
},
{
"role": "button",
"name": "Close message"
}
]
}
</p>
`;
/* end snapshot sbb-alert-group should render A11y tree Safari */

3 changes: 0 additions & 3 deletions src/components/alert/alert-group/alert-group.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ describe(`sbb-alert-group with ${fixture.name}`, () => {
const didDismissAlertSpy = new EventSpy(SbbAlertGroupElement.events.didDismissAlert);
const emptySpy = new EventSpy(SbbAlertGroupElement.events.empty);

// When rendering initially
await waitForLitRender(element);

// Then two alerts should be rendered and accessibility title should be displayed
expect(element.querySelectorAll('sbb-alert').length).to.be.equal(2);
const alertGroupTitle = element.shadowRoot!.querySelector('.sbb-alert-group__title')!;
Expand Down
2 changes: 0 additions & 2 deletions src/components/alert/alert-group/alert-group.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';

import { waitForLitRender } from '../../core/testing';
import { fixture, testA11yTreeSnapshot } from '../../core/testing/private';

import type { SbbAlertGroupElement } from './alert-group';
Expand All @@ -23,7 +22,6 @@ describe(`sbb-alert-group`, () => {
</sbb-alert>
</sbb-alert-group>
`);
await waitForLitRender(root);
});

it('Dom', async () => {
Expand Down
41 changes: 0 additions & 41 deletions src/components/alert/alert/__snapshots__/alert.spec.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,44 +215,3 @@ snapshots["sbb-alert A11y tree Firefox"] =
`;
/* end snapshot sbb-alert A11y tree Firefox */

snapshots["sbb-alert A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "heading",
"name": "Interruption",
"level": 3
},
{
"role": "text",
"name": "Alert content "
},
{
"role": "link",
"name": "test-a11y-label",
"children": [
{
"role": "link",
"name": "Find out more",
"children": [
{
"role": "text",
"name": "Find out more"
}
]
}
]
},
{
"role": "button",
"name": "Close message"
}
]
}
</p>
`;
/* end snapshot sbb-alert A11y tree Safari */

4 changes: 0 additions & 4 deletions src/components/alert/alert/alert.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';

import { waitForLitRender } from '../../core/testing';
import { fixture, testA11yTreeSnapshot } from '../../core/testing/private';

import type { SbbAlertElement } from './alert';
Expand All @@ -15,7 +14,6 @@ describe(`sbb-alert`, () => {
element = await fixture(
html`<sbb-alert disable-animation title-content="Interruption">Alert content</sbb-alert>`,
);
await waitForLitRender(element);

expect(element).dom.to.be.equal(
`
Expand Down Expand Up @@ -45,8 +43,6 @@ describe(`sbb-alert`, () => {
>`,
);

await waitForLitRender(element);

expect(element).dom.to.be.equal(
`
<sbb-alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,25 +353,3 @@ snapshots["sbb-autocomplete renders in form field Safari ShadowDom"] =
`;
/* end snapshot sbb-autocomplete renders in form field Safari ShadowDom */

snapshots["sbb-autocomplete renders in form field A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "text",
"name": "​"
},
{
"role": "combobox",
"name": "",
"autocomplete": "list",
"haspopup": "listbox"
}
]
}
</p>
`;
/* end snapshot sbb-autocomplete renders in form field A11y tree Safari */

34 changes: 17 additions & 17 deletions src/components/autocomplete/autocomplete.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from '@open-wc/testing';
import { html } from 'lit/static-html.js';

import { isSafari } from '../core/dom';
import { describeIf, waitForLitRender } from '../core/testing';
import { describeIf } from '../core/testing';
import { fixture, testA11yTreeSnapshot } from '../core/testing/private';
import type { SbbFormFieldElement } from '../form-field';

Expand All @@ -13,38 +13,39 @@ import './autocomplete';

describe(`sbb-autocomplete`, () => {
describe('renders standalone', async () => {
let elem: SbbAutocompleteElement;
let element: SbbAutocompleteElement;

beforeEach(async () => {
await fixture(html`
<div id="origin"></div>
<input id="trigger" />
<sbb-autocomplete origin="origin" trigger="trigger">
<sbb-option value="1">1</sbb-option>
<sbb-option value="2">2</sbb-option>
</sbb-autocomplete>
`);
elem = document.querySelector('sbb-autocomplete')!;
await waitForLitRender(elem);
const testFixture = await fixture(
html`<div>
<div id="origin"></div>
<input id="trigger" />
<sbb-autocomplete origin="origin" trigger="trigger">
<sbb-option value="1">1</sbb-option>
<sbb-option value="2">2</sbb-option>
</sbb-autocomplete>
</div> `,
);
element = testFixture.querySelector('sbb-autocomplete')!;
});

describeIf(!isSafari(), 'Chrome-Firefox', async () => {
it('Dom', async () => {
await expect(elem).dom.to.be.equalSnapshot();
await expect(element).dom.to.be.equalSnapshot();
});

it('ShadowDom', async () => {
await expect(elem).shadowDom.to.be.equalSnapshot();
await expect(element).shadowDom.to.be.equalSnapshot();
});
});

describeIf(isSafari(), 'Safari', async () => {
it('Dom', async () => {
await expect(elem).dom.to.be.equalSnapshot();
await expect(element).dom.to.be.equalSnapshot();
});

it('ShadowDom', async () => {
await expect(elem).shadowDom.to.be.equalSnapshot();
await expect(element).shadowDom.to.be.equalSnapshot();
});
});
});
Expand All @@ -62,7 +63,6 @@ describe(`sbb-autocomplete`, () => {
</sbb-autocomplete>
</sbb-form-field>
`);
await waitForLitRender(root);
});

describeIf(!isSafari(), 'Chrome-Firefox', async () => {
Expand Down
Loading
Loading