Skip to content

Commit 5f2e653

Browse files
authored
fix(tabs): imperative instantiation of tabs-panel (#2521)
* fix(tabs): imperatively instantiate tabs panel * test: imperative instantiation * fix(create-element): imperative instantiation in tests
1 parent 933a0d6 commit 5f2e653

File tree

24 files changed

+105
-3
lines changed

24 files changed

+105
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@patternfly/create-element": patch
3+
---
4+
Tests: check for imperative element instantiation
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@patternfly/elements": patch
3+
---
4+
`<pf-tabs>`: prevent error when using tabs-panel with certain frameworks or imperative javascript code

elements/pf-accordion/test/pf-accordion.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ describe('<pf-accordion>', function() {
6363
};
6464
}
6565

66+
it('imperatively instantiates', function() {
67+
expect(document.createElement('pf-accordion')).to.be.an.instanceof(PfAccordion);
68+
expect(document.createElement('pf-accordion-header')).to.be.an.instanceof(PfAccordionHeader);
69+
expect(document.createElement('pf-accordion-panel')).to.be.an.instanceof(PfAccordionPanel);
70+
});
71+
6672
it('simply instantiating', async function() {
6773
element = await createFixture<PfAccordion>(html`<pf-accordion></pf-accordion>`);
6874
expect(element, 'pf-accordion should be an instance of PfAccordion')

elements/pf-avatar/test/pf-avatar.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { PfAvatar } from '@patternfly/elements/pf-avatar/pf-avatar.js';
44
import { AvatarLoadEvent } from '../BaseAvatar';
55

66
describe('<pf-avatar>', function() {
7+
it('imperatively instantiates', function() {
8+
expect(document.createElement('pf-avatar')).to.be.an.instanceof(PfAvatar);
9+
});
10+
711
it('should upgrade', async function() {
812
const el = await createFixture(html`<pf-avatar></pf-avatar>`);
913
expect(el, 'pf-badge should be an instance of PfAvatar')

elements/pf-badge/test/pf-badge.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const states = {
1313
const element = html`<pf-badge number="10">10</pf-badge>`;
1414

1515
describe('<pf-badge>', function() {
16+
it('imperatively instantiates', function() {
17+
expect(document.createElement('pf-badge')).to.be.an.instanceof(PfBadge);
18+
});
19+
1620
it('should upgrade', async function() {
1721
const el = await createFixture<PfBadge>(element);
1822
expect(el, 'pf-badge should be an instance of PfBadge')

elements/pf-button/test/pf-button.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import { PfButton } from '@patternfly/elements/pf-button/pf-button.js';
77
import '@patternfly/pfe-tools/test/stub-logger.js';
88

99
describe('<pf-button>', function() {
10+
it('imperatively instantiates', function() {
11+
expect(document.createElement('pf-button')).to.be.an.instanceof(PfButton);
12+
});
13+
1014
it('should upgrade', async function() {
1115
const el = await createFixture(html`<pf-button>Button</pf-button>`);
1216
expect(el, 'pf-button should be an instance of PfButton')

elements/pf-card/test/pf-card.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import '@patternfly/pfe-tools/test/stub-logger.js';
55
import { PfCard } from '@patternfly/elements/pf-card/pf-card.js';
66

77
describe('<pf-card>', function() {
8+
it('imperatively instantiates', function() {
9+
expect(document.createElement('pf-card')).to.be.an.instanceof(PfCard);
10+
});
11+
812
it('should upgrade', async function() {
913
expect(await createFixture<PfCard>(html`<pf-card></pf-card>`))
1014
.to.be.an.instanceof(customElements.get('pf-card'))

elements/pf-clipboard-copy/test/pf-clipboard-copy.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ describe('<pf-clipboard-copy>', function() {
2323
`);
2424
});
2525

26+
it('imperatively instantiates', function() {
27+
expect(document.createElement('pf-clipboard-copy')).to.be.an.instanceof(PfClipboardCopy);
28+
});
29+
2630
it('should upgrade', async function() {
2731
const klass = customElements.get('pf-clipboard-copy');
2832
expect(element)

elements/pf-code-block/test/pf-code-block.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const expandElementByDefault = html`
4848
`;
4949

5050
describe('<pf-code-block>', function() {
51+
it('imperatively instantiates', function() {
52+
expect(document.createElement('pf-code-block')).to.be.an.instanceof(PfCodeBlock);
53+
});
54+
5155
it('should upgrade', async function() {
5256
const el = await createFixture <PfCodeBlock>(element);
5357
const klass = customElements.get('pf-code-block');

elements/pf-icon/test/pf-icon.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ describe('<pf-icon>', function() {
2525
element = await fixture(html`<pf-icon></pf-icon>`);
2626
});
2727

28+
it('imperatively instantiates', function() {
29+
expect(document.createElement('pf-icon')).to.be.an.instanceof(PfIcon);
30+
});
31+
2832
it('should upgrade', function() {
2933
expect(element, 'pf-icon should be an instance of PfIcon')
3034
.to.be.an.instanceOf(customElements.get('pf-icon'))

0 commit comments

Comments
 (0)