File tree Expand file tree Collapse file tree 8 files changed +136
-0
lines changed
Expand file tree Collapse file tree 8 files changed +136
-0
lines changed Original file line number Diff line number Diff line change 3636 "./pf-jump-links/pf-jump-links-list.js" : " ./pf-jump-links/pf-jump-links-list.js" ,
3737 "./pf-jump-links/pf-jump-links.js" : " ./pf-jump-links/pf-jump-links.js" ,
3838 "./pf-label/pf-label.js" : " ./pf-label/pf-label.js" ,
39+ "./pf-radio/pf-radio.js" : " ./pf-radio/pf-radio.js" ,
3940 "./pf-select/pf-select.js" : " ./pf-select/pf-select.js" ,
4041 "./pf-select/pf-listbox.js" : " ./pf-select/pf-listbox.js" ,
4142 "./pf-select/pf-option-group.js" : " ./pf-select/pf-option-group.js" ,
Original file line number Diff line number Diff line change 1+ # Radio
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-radio >
9+
10+ </pf-radio >
11+ ```
Original file line number Diff line number Diff line change 1+ < pf-radio > </ pf-radio >
2+
3+ < script type ="module ">
4+ import '@patternfly/elements/pf-radio/pf-radio.js' ;
5+ </ script >
6+
7+ < style >
8+ pf-radio {
9+ /* insert demo styles */
10+ }
11+ </ style >
12+
Original file line number Diff line number Diff line change 1+ {% renderOverview %}
2+ <pf-radio ></pf-radio >
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 %}
Original file line number Diff line number Diff line change 1+ : host {
2+ dis play: block;
3+ }
Original file line number Diff line number Diff line change 1+ import { LitElement , html , type TemplateResult } from 'lit' ;
2+ import { customElement } from 'lit/decorators/custom-element.js' ;
3+
4+ import styles from './pf-radio.css' ;
5+ import { property } from 'lit/decorators/property.js' ;
6+
7+ /**
8+ * Radio
9+ * @slot - Place element content here
10+ */
11+ @customElement ( 'pf-radio' )
12+ export class PfRadio extends LitElement {
13+ static readonly styles : CSSStyleSheet [ ] = [ styles ] ;
14+ @property ( ) checked = false ;
15+ @property ( { reflect : true } ) name = 'radio-test' ;
16+ @property ( { reflect : true } ) label ?: string ;
17+ // #input:any
18+
19+ constructor ( ) {
20+ super ( ) ;
21+ }
22+
23+ connectedCallback ( ) : void {
24+ super . connectedCallback ( ) ;
25+
26+ const root = this . getRootNode ( ) ;
27+ if ( root instanceof Document || root instanceof ShadowRoot ) {
28+ const group = root . querySelectorAll ( `pf-radio` ) ;
29+ // console.log("------------- the group is", group);
30+ }
31+ }
32+
33+
34+ render ( ) : TemplateResult < 1 > {
35+ return html `
36+ < label for =input > ${ this . label } </ label >
37+ < input id =input class ="pf-radio " .name =${ this . name } type ="radio" .checked="${ this . checked } ">
38+ ` ;
39+ }
40+ }
41+
42+ declare global {
43+ interface HTMLElementTagNameMap {
44+ 'pf-radio' : PfRadio ;
45+ }
46+ }
Original file line number Diff line number Diff line change 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-radio' ;
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+ } ) ;
Original file line number Diff line number Diff line change 1+ import { expect , html } from '@open-wc/testing' ;
2+ import { createFixture } from '@patternfly/pfe-tools/test/create-fixture.js' ;
3+ import { PfRadio } from '@patternfly/elements/pf-radio/pf-radio.js' ;
4+
5+ describe ( '<pf-radio>' , function ( ) {
6+ describe ( 'simply instantiating' , function ( ) {
7+ let element : PfRadio ;
8+ it ( 'imperatively instantiates' , function ( ) {
9+ expect ( document . createElement ( 'pf-radio' ) ) . to . be . an . instanceof ( PfRadio ) ;
10+ } ) ;
11+
12+ it ( 'should upgrade' , async function ( ) {
13+ element = await createFixture < PfRadio > ( html `< pf-radio > </ pf-radio > ` ) ;
14+ const klass = customElements . get ( 'pf-radio' ) ;
15+ expect ( element )
16+ . to . be . an . instanceOf ( klass )
17+ . and
18+ . to . be . an . instanceOf ( PfRadio ) ;
19+ } ) ;
20+ } ) ;
21+ } ) ;
You can’t perform that action at this time.
0 commit comments