Skip to content

Commit

Permalink
fix(checked): react to slot changes
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrich committed Jul 6, 2021
1 parent 6ef33ae commit 6e622ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
"ignorePatterns": ["test/*.js", ".eslintrc.js"],
"env": {
"browser": true,
"es6": true
Expand Down
2 changes: 1 addition & 1 deletion src/auro-radio-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class AuroRadioGroup extends LitElement {
super();
this.index = 0;
this.max = 3;
this.items = Array.from(this.querySelectorAll('auro-radio'));
}

static get styles() {
Expand Down Expand Up @@ -51,6 +50,7 @@ class AuroRadioGroup extends LitElement {
}

handleItems() {
this.items = Array.from(this.querySelectorAll('auro-radio'));
this.initializeIndex();

if (this.disabled) {
Expand Down
8 changes: 5 additions & 3 deletions test/auro-radio.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -648,21 +648,23 @@ describe('auro-radio-group', () => {
});

it('reacts to slot changes', async () => {
const el = await fixture(html`<auro-radio-group label="Select your state of residence">
const el = await fixture(html`<auro-radio-group label="Select your state of residence"></auro-radio-group>`);

// render radio children after the group has connected
await fixture(html`
<auro-radio
id="alaska"
label="Alaska"
name="states"
value="alaska"
></auro-radio>
<auro-radio
id="washington"
label="Washington"
name="states"
value="washington"
></auro-radio>
</auro-radio-group>`);
`, { parentNode: el });

const alaskaRadio = el.querySelector("auro-radio[id=alaska]");
const alaskaRadioInput = alaskaRadio.shadowRoot.querySelector('input');
Expand Down

0 comments on commit 6e622ac

Please sign in to comment.