Skip to content

Commit c9c3b56

Browse files
zhawkinsZack HawkinsheyMP
authored
chore: Minor testing updates (#1690)
* Minor testing updates * chore: update changelog Co-authored-by: Zack Hawkins <[email protected]> Co-authored-by: heyMP <[email protected]>
1 parent 845efa3 commit c9c3b56

File tree

3 files changed

+42
-27
lines changed

3 files changed

+42
-27
lines changed

CHANGELOG-1.x.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 1.x.x (TBD)
2+
3+
- [](https://github.com/patternfly/patternfly-elements/commit/) chore: Minor testing updates
4+
15
# 1.9.3 (2021-06-16)
26

37
- [b7fc80d](https://github.com/patternfly/patternfly-elements/commit/b7fc80d3417eb14be519c6e37895fcff639d1bbd) fix: set margin-top for ctas in footer on mobile

generators/test/templates/_element.spec.js

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@ import '../dist/<%= elementName %>';
1111

1212
// One element, defined here, is used
1313
// in multiple tests. It's torn down and recreated each time.
14-
const element =
14+
const testElement =
1515
`<<%= elementName %>>
1616
</<%= elementName %>>
1717
`;
1818

1919
describe("<<%= elementName %>>", () => {
2020

21-
it("it should upgrade", async () => {
22-
const el = await createFixture(element);
23-
24-
expect(el).to.be.an.instanceOf(
25-
customElements.get("<%= elementName %>"),
26-
'<%= elementName %> should be an instance of <%= className %>'
27-
);
28-
});
29-
30-
// Example test.
31-
it("should apply attributes correctly", async () => {
32-
// Use the same markup that's declared at the top of the file.
33-
const el = await createFixture(element);
34-
});
35-
36-
// Example test.
37-
it("should have a slot", async () => {
38-
// If you need custom markup for this single test, pass it into the
39-
// fixture wrapper.
40-
const el = await createFixture(`
41-
<<%= elementName %>>
42-
<div>Hello world 👋</div>
43-
</<%= elementName %>>
44-
`);
45-
expect(el).to.exist;
46-
});
21+
it("it should upgrade", async () => {
22+
const el = await createFixture(testElement);
23+
24+
expect(el).to.be.an.instanceOf(
25+
customElements.get("<%= elementName %>"),
26+
'<%= elementName %> should be an instance of <%= className %>'
27+
);
28+
});
29+
30+
// Example test.
31+
it("should apply attributes correctly", async () => {
32+
// Use the same markup that's declared at the top of the file.
33+
const el = await createFixture(testElement);
34+
});
35+
36+
// Example test.
37+
it("should have a slot", async () => {
38+
// If you need custom markup for this single test, pass it into the
39+
// fixture wrapper.
40+
const el = await createFixture(`
41+
<<%= elementName %>>
42+
<div>Hello world 👋</div>
43+
</<%= elementName %>>
44+
`);
45+
expect(el).to.exist;
46+
});
4747
});

web-test-runner.config.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,22 @@ export default {
55
}
66
},
77
files: "elements/*/test/*.spec.js",
8+
testRunnerHtml: testFramework =>
9+
`<html>
10+
<head>
11+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
12+
</head>
13+
<body>
14+
<script type="module" src="${testFramework}"></script>
15+
</body>
16+
</html>`,
817
groups: [
918
{
1019
name: 'with-vue',
1120
testRunnerHtml: testFramework =>
1221
`<html>
1322
<head>
23+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
1424
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js" crossorigin></script>
1525
</head>
1626
<body>
@@ -24,6 +34,7 @@ export default {
2434
testRunnerHtml: testFramework =>
2535
`<html>
2636
<head>
37+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
2738
<script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin></script>
2839
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin></script>
2940
<script src="https://unpkg.com/@babel/standalone/babel.min.js" crossorigin></script>

0 commit comments

Comments
 (0)