Skip to content

Commit

Permalink
Add value & name attributes for checkable (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizniz187 committed Aug 30, 2021
1 parent 7c2dc2c commit a41f972
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion wc/components/Checkable/Checkable.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class Checkable extends WComponent{
parser: (value, attr) => AttributeParser.parseBoolAttr(
value, attr.defaultValue
)
}
},
value: { name: 'value' },
name: { name: 'name' }
};
static get observedAttributes() {
return this.getObservedAttributes(this.attributes);
Expand All @@ -83,6 +85,8 @@ class Checkable extends WComponent{
const inputAttrs = {};
if(this.checked) { inputAttrs.checked = true; }
if(this.disabled) { inputAttrs.disabled = true; }
if(this.value) { inputAttrs.value = this.value; }
if(this.name) { inputAttrs.name = this.name; }
DOM.create('input', { props: inputProps, attrs: inputAttrs }, ctn);

const iconProps = { className: 'icon' };
Expand Down
6 changes: 5 additions & 1 deletion wc/components/checkable/Checkable.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class Checkable extends WComponent{
parser: (value, attr) => AttributeParser.parseBoolAttr(
value, attr.defaultValue
)
}
},
value: { name: 'value' },
name: { name: 'name' }
};
static get observedAttributes() {
return this.getObservedAttributes(this.attributes);
Expand All @@ -83,6 +85,8 @@ class Checkable extends WComponent{
const inputAttrs = {};
if(this.checked) { inputAttrs.checked = true; }
if(this.disabled) { inputAttrs.disabled = true; }
if(this.value) { inputAttrs.value = this.value; }
if(this.name) { inputAttrs.name = this.name; }
DOM.create('input', { props: inputProps, attrs: inputAttrs }, ctn);

const iconProps = { className: 'icon' };
Expand Down

0 comments on commit a41f972

Please sign in to comment.