Skip to content

Commit

Permalink
test: add e2e and spec tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dauriamarco committed Mar 15, 2024
1 parent d82a1af commit fce960f
Show file tree
Hide file tree
Showing 9 changed files with 549 additions and 116 deletions.
25 changes: 0 additions & 25 deletions src/components/stepper/step-label/step-label.e2e.ts

This file was deleted.

39 changes: 25 additions & 14 deletions src/components/stepper/step-label/step-label.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
// import { expect, fixture } from '@open-wc/testing';
// import { html } from 'lit/static-html.js';
// import './step-label';
import { expect, fixture } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
import './step-label';

// describe('sbb-step-label', () => {
// it('renders', async () => {
// const root = await fixture(html`<sbb-step-label my-prop="Label"></sbb-step-label>`);
describe('sbb-step-label', () => {
it('renders', async () => {
const root = await fixture(html`<sbb-step-label></sbb-step-label>`);

// expect(root).dom.to.be.equal(`<sbb-step-label my-prop="Label"></sbb-step-label>`);
expect(root).dom.to.be.equal(`
<sbb-step-label
data-action
data-button
dir="ltr"
id="sbb-step-label-0"
role="tab"
slot="step-label"
tabindex="0"
></sbb-step-label>
`);

// expect(root).shadowDom.to.be.equal(`
// <div class="sbb-step-label">
// Label
// </div>
// `);
// });
// });
expect(root).shadowDom.to.be.equal(`
<div class="sbb-step-label">
<span class="sbb-step-label__prefix"><slot name="icon"></slot></span>
<span class="sbb-step-label__text"><slot></slot></span>
</div>
`);
});
});
25 changes: 0 additions & 25 deletions src/components/stepper/step/step.e2e.ts

This file was deleted.

32 changes: 18 additions & 14 deletions src/components/stepper/step/step.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
// import { expect, fixture } from '@open-wc/testing';
// import { html } from 'lit/static-html.js';
// import './step';
import { expect, fixture } from '@open-wc/testing';
import { html } from 'lit/static-html.js';
import './step';

// describe('sbb-step', () => {
// it('renders', async () => {
// const root = await fixture(html`<sbb-step my-prop="Label"></sbb-step>`);
describe('sbb-step', () => {
it('renders', async () => {
const root = await fixture(html`<sbb-step></sbb-step>`);

// expect(root).dom.to.be.equal(`<sbb-step my-prop="Label"></sbb-step>`);
expect(root).dom.to.be.equal(
`<sbb-step id="sbb-step-0" role="tabpanel" slot="step"></sbb-step>`,
);

// expect(root).shadowDom.to.be.equal(`
// <div class="sbb-step">
// Label
// </div>
// `);
// });
// });
expect(root).shadowDom.to.be.equal(`
<div class="sbb-step--wrapper">
<div class="sbb-step">
<slot></slot>
</div>
</div>
`);
});
});
147 changes: 147 additions & 0 deletions src/components/stepper/stepper/__snapshots__/stepper.spec.snap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/* @web/test-runner snapshot v1 */
export const snapshots = {};

snapshots["sbb-stepper renders"] =
`<div class="sbb-stepper">
<div
class="sbb-stepper__labels"
role="tablist"
>
<slot name="step-label">
</slot>
</div>
<div class="sbb-stepper__steps">
<slot name="step">
</slot>
</div>
</div>
`;
/* end snapshot sbb-stepper renders */

snapshots["sbb-tab-group A11y tree Chrome"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "tab",
"name": "Test step label 1",
"selected": true
},
{
"role": "tab",
"name": "Test step label 2"
},
{
"role": "tab",
"name": "Test step label 3"
},
{
"role": "tab",
"name": "Test step label 4"
},
{
"role": "tabpanel",
"name": "",
"children": [
{
"role": "text",
"name": "Test step content 1"
}
]
}
]
}
</p>
`;
/* end snapshot sbb-tab-group A11y tree Chrome */

snapshots["sbb-tab-group A11y tree Firefox"] =
`<p>
{
"role": "document",
"name": "",
"children": [
{
"role": "tab",
"name": "Test step label 1",
"selected": true
},
{
"role": "tab",
"name": "Test step label 2"
},
{
"role": "tab",
"name": "Test step label 3"
},
{
"role": "tab",
"name": "Test step label 4"
},
{
"role": "tabpanel",
"name": "",
"children": [
{
"role": "text leaf",
"name": "Test step content 1"
}
]
}
]
}
</p>
`;
/* end snapshot sbb-tab-group A11y tree Firefox */

snapshots["sbb-tab-group A11y tree Safari"] =
`<p>
{
"role": "WebArea",
"name": "",
"children": [
{
"role": "tab",
"name": "Test step label 1",
"selected": true
},
{
"role": "tab",
"name": "Test step label 2"
},
{
"role": "tab",
"name": "Test step label 3"
},
{
"role": "tab",
"name": "Test step label 4"
},
{
"role": "tabpanel",
"name": "",
"children": [
{
"role": "text",
"name": "Test step content 1"
}
]
}
]
}
</p>
`;
/* end snapshot sbb-tab-group A11y tree Safari */

snapshots["sbb-stepper A11y tree Chrome"] =
`<p>
{
"role": "WebArea",
"name": ""
}
</p>
`;
/* end snapshot sbb-stepper A11y tree Chrome */

Loading

0 comments on commit fce960f

Please sign in to comment.