Skip to content

Commit d86e8ac

Browse files
author
Sara Dahan
committed
feat(label-group): add new label-group-element
1 parent a850589 commit d86e8ac

File tree

8 files changed

+115
-0
lines changed

8 files changed

+115
-0
lines changed

elements/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"./pf-jump-links/pf-jump-links-item.js": "./pf-jump-links/pf-jump-links-item.js",
3737
"./pf-jump-links/pf-jump-links-list.js": "./pf-jump-links/pf-jump-links-list.js",
3838
"./pf-jump-links/pf-jump-links.js": "./pf-jump-links/pf-jump-links.js",
39+
"./pf-label-group/pf-label-group.js": "./pf-label-group/pf-label-group.js",
3940
"./pf-label/pf-label.js": "./pf-label/pf-label.js",
4041
"./pf-select/pf-select.js": "./pf-select/pf-select.js",
4142
"./pf-select/pf-listbox.js": "./pf-select/pf-listbox.js",

elements/pf-label-group/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Label Group
2+
Add a description of the component here.
3+
4+
## Usage
5+
Describe how best to use this web component along with best practices.
6+
7+
```html
8+
<pf-label-group>
9+
10+
</pf-label-group>
11+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<pf-label-group></pf-label-group>
2+
3+
<script type="module">
4+
import '@patternfly/elements/pf-label-group/pf-label-group.js';
5+
</script>
6+
7+
<style>
8+
pf-label-group {
9+
/* insert demo styles */
10+
}
11+
</style>
12+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% renderOverview %}
2+
<pf-label-group></pf-label-group>
3+
{% endrenderOverview %}
4+
5+
{% band header="Usage" %}{% endband %}
6+
7+
{% renderSlots %}{% endrenderSlots %}
8+
9+
{% renderAttributes %}{% endrenderAttributes %}
10+
11+
{% renderMethods %}{% endrenderMethods %}
12+
13+
{% renderEvents %}{% endrenderEvents %}
14+
15+
{% renderCssCustomProperties %}{% endrenderCssCustomProperties %}
16+
17+
{% renderCssParts %}{% endrenderCssParts %}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
display: block;
3+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { LitElement, html, type TemplateResult } from 'lit';
2+
import { customElement } from 'lit/decorators/custom-element.js';
3+
4+
import styles from './pf-label-group.css';
5+
6+
/**
7+
* Label Group
8+
* @slot - Place element content here
9+
*/
10+
@customElement('pf-label-group')
11+
export class PfLabelGroup extends LitElement {
12+
static readonly styles: CSSStyleSheet[] = [styles];
13+
14+
render(): TemplateResult<1> {
15+
return html`
16+
<slot></slot>
17+
`;
18+
}
19+
}
20+
21+
declare global {
22+
interface HTMLElementTagNameMap {
23+
'pf-label-group': PfLabelGroup;
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { test } from '@playwright/test';
2+
import { PfeDemoPage } from '@patternfly/pfe-tools/test/playwright/PfeDemoPage.js';
3+
import { SSRPage } from '@patternfly/pfe-tools/test/playwright/SSRPage.js';
4+
5+
const tagName = 'pf-label-group';
6+
7+
test.describe(tagName, () => {
8+
test('snapshot', async ({ page }) => {
9+
const componentPage = new PfeDemoPage(page, tagName);
10+
await componentPage.navigate();
11+
await componentPage.snapshot();
12+
});
13+
14+
test('ssr', async ({ browser }) => {
15+
const fixture = new SSRPage({
16+
tagName,
17+
browser,
18+
demoDir: new URL('../demo/', import.meta.url),
19+
importSpecifiers: [
20+
`@patternfly/elements/${tagName}/${tagName}.js`,
21+
],
22+
});
23+
await fixture.snapshots();
24+
});
25+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { expect, html } from '@open-wc/testing';
2+
import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js';
3+
import { PfLabelGroup } from '@patternfly/elements/pf-label-group/pf-label-group.js';
4+
5+
describe('<pf-label-group>', function() {
6+
describe('simply instantiating', function() {
7+
let element: PfLabelGroup;
8+
it('imperatively instantiates', function() {
9+
expect(document.createElement('pf-label-group')).to.be.an.instanceof(PfLabelGroup);
10+
});
11+
12+
it('should upgrade', async function() {
13+
element = await createFixture<PfLabelGroup>(html`<pf-label-group></pf-label-group>`);
14+
const klass = customElements.get('pf-label-group');
15+
expect(element)
16+
.to.be.an.instanceOf(klass)
17+
.and
18+
.to.be.an.instanceOf(PfLabelGroup);
19+
});
20+
});
21+
});

0 commit comments

Comments
 (0)