Skip to content

Commit 51e988c

Browse files
mwczkylebuch8
andauthored
fix: pfelement - restore pfelement tests (#1018)
* fix: improve CLS rating in lighthouse * test(pfelement): restore pfelement tests, as they were not running * changelog updates for pfelement Co-authored-by: Kyle Buchanan <[email protected]>
1 parent fbe4423 commit 51e988c

File tree

5 files changed

+24
-19
lines changed

5 files changed

+24
-19
lines changed

CHANGELOG-prerelease.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Prerelease 55 ( TBD )
22

3-
- [](https://github.com/patternfly/patternfly-elements/commit/)
4-
- [](https://github.com/patternfly/patternfly-elements/commit/) fix: improve CLS rating in lighthouse (#1020)
3+
- [](https://github.com/patternfly/patternfly-elements/commit/) fix: pfelement - restore pfelement tests (#1018)
4+
- [fbe4423](https://github.com/patternfly/patternfly-elements/commit/fbe442396f06b0a097366512b698dc0b6d5e1f9f) fix: improve CLS rating in lighthouse (#1020)
55

66
## Prerelease 54 ( 2020-07-31 )
77

elements/pfelement/test/pfelement_cascade_attribute_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<pfe-parent test-attr="foo"></pfe-parent>
1212

1313
<script type="module">
14-
import PFElement from "../pfelement.js";
14+
import PFElement from "../dist/pfelement.js";
1515

1616
class PfeParent extends PFElement {
1717
static get tag() {

elements/pfelement/test/pfelement_emitEvent.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</pfelement>
1414

1515
<script type="module">
16-
import PFElement from "../pfelement.js";
16+
import PFElement from "../dist/pfelement.js";
1717

1818
class TestElement extends PFElement {
1919
static get tag() {
@@ -27,7 +27,7 @@
2727
}
2828

2929
constructor() {
30-
super(TestElement.tag);
30+
super(TestElement);
3131
}
3232
}
3333

elements/pfelement/test/pfelement_logging_test.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<pfe-test test-attr="1"></pfe-test>
1212

1313
<script type="module">
14-
import PFElement from "../pfelement.js";
14+
import PFElement from "../dist/pfelement.js";
1515

1616
class PfeTest extends PFElement {
1717
static get tag() {

elements/pfelement/test/pfelement_test.html

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</pfelement>
1414

1515
<script type="module">
16-
import PFElement from "../pfelement.js";
16+
import PFElement from "../dist/pfelement.js";
1717

1818
const colors = ["red", "yellow", "blue"];
1919

@@ -29,7 +29,7 @@
2929
}
3030

3131
constructor() {
32-
super(TestElement.tag, { type: PFElement.PfeTypes.Content });
32+
super(TestElement, { type: PFElement.PfeTypes.Content });
3333
}
3434
}
3535

@@ -49,7 +49,7 @@
4949
}
5050

5151
constructor() {
52-
super(TestElementDelayRender.tag, { delayRender: true });
52+
super(TestElementDelayRender, { delayRender: true });
5353
}
5454

5555
connectedCallback() {
@@ -121,21 +121,26 @@
121121
});
122122
});
123123

124-
test("it should throw an error when the on attribute is manually added", done => {
124+
test("it should throw an error when the on attribute is manually added", () => {
125125
const spy = sinon.spy(console, "warn");
126126

127-
const testElementEl = document.createElement("test-element");
128-
testElementEl.id = "test-element";
129-
testElementEl.setAttribute("on", "saturated");
130-
document.body.appendChild(testElementEl);
127+
// with an id
131128

132-
sinon.assert.calledWith(spy, `pfe-test-element[#test-element]: The "on" attribute is protected and should not be manually added to a component. The base class will manage this value for you on upgrade.`);
129+
const testElementEl1 = document.createElement("test-element");
133130

134-
testElementEl.removeAttribute("id");
135-
document.body.appendChild(testElementEl);
136-
sinon.assert.calledWith(spy, `pfe-test-element: The "on" attribute is protected and should not be manually added to a component. The base class will manage this value for you on upgrade.`);
131+
testElementEl1.id = "test-element";
132+
testElementEl1.setAttribute("on", "saturated");
137133

138-
document.body.removeChild(testElementEl);
134+
document.body.appendChild(testElementEl1);
135+
136+
sinon.assert.calledWith(spy, `test-element[#test-element]: The "on" attribute is protected and should not be manually added to a component. The base class will manage this value for you on upgrade.`);
137+
138+
// without an id
139+
140+
const testElementEl2 = document.createElement("test-element");
141+
testElementEl2.setAttribute("on", "saturated");
142+
document.body.appendChild(testElementEl2);
143+
sinon.assert.calledWith(spy, `test-element: The "on" attribute is protected and should not be manually added to a component. The base class will manage this value for you on upgrade.`);
139144
});
140145
});
141146
</script>

0 commit comments

Comments
 (0)