-
Notifications
You must be signed in to change notification settings - Fork 7
feat(oui-switch): add new oui-switch component #191
Conversation
packages/oui-switch/README.md
Outdated
|
||
| Attribute | Type | Binding | One-time Binding | Values | Default | Description | ||
| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ||
| label | string | @ | | | | switch label |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Labels, Help texts should only be managed by the oui-field
component.
oui-switch
should be a form control, not a form field.
} | ||
|
||
$postLink () { | ||
addBooleanParameter(this, "required"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already done in the $onInit
packages/oui-switch/src/switch.html
Outdated
<div class="oui-switch"> | ||
<label class="oui-switch__label" ng-bind="::$ctrl.label"></label> | ||
<label class="oui-switch__container"> | ||
<input type="checkbox" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the form validation, we have to support id
and name
attributes.
eg. https://github.com/ovh-ux/ovh-ui-angular/blob/master/packages/oui-checkbox/src/checkbox.html#L4
packages/oui-switch/src/switch.html
Outdated
@@ -0,0 +1,17 @@ | |||
<div class="oui-switch"> | |||
<label class="oui-switch__label" ng-bind="::$ctrl.label"></label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate from oui-field
packages/oui-switch/src/switch.html
Outdated
> | ||
<div class="oui-switch__slider"></div> | ||
</label> | ||
<div class="oui-switch__helper" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here :)
packages/oui-switch/src/switch.html
Outdated
@@ -0,0 +1,17 @@ | |||
<div class="oui-switch"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have only a static class on this DIV, we should add it on the root element oui-switch
to remove this one.
|
||
describe("text attribute", () => { | ||
it("should display a switch label", () => { | ||
const element = TestUtils.compileTemplate("<oui-switch label=\"test\"></oui-switch>"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests should be updated too, if we use oui-field
:)
f577953
to
b1b1967
Compare
b1b1967
to
d8bccf1
Compare
9b75473
to
77e0d06
Compare
/#!/ovh-ui-angular/switch @ ovh_ui_kit_documentation-feat_oui_switch_staging
Linked to
ovh/ovh-ui-kit#211
ovh-ux/ovh-ui-kit-documentation#125