Skip to content
This repository was archived by the owner on Aug 7, 2020. It is now read-only.

Conversation

varun257
Copy link
Contributor

@varun257 varun257 commented May 24, 2018

/#!/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


| Attribute | Type | Binding | One-time Binding | Values | Default | Description
| ---- | ---- | ---- | ---- | ---- | ---- | ----
| label | string | @ | | | | switch label
Copy link
Contributor

@AxelPeter AxelPeter May 25, 2018

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.

https://master.ui-kit.ovh/#!/oui-angular/field

}

$postLink () {
addBooleanParameter(this, "required");
Copy link
Contributor

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

<div class="oui-switch">
<label class="oui-switch__label" ng-bind="::$ctrl.label"></label>
<label class="oui-switch__container">
<input type="checkbox"
Copy link
Contributor

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

@@ -0,0 +1,17 @@
<div class="oui-switch">
<label class="oui-switch__label" ng-bind="::$ctrl.label"></label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate from oui-field

>
<div class="oui-switch__slider"></div>
</label>
<div class="oui-switch__helper"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here :)

@@ -0,0 +1,17 @@
<div class="oui-switch">
Copy link
Contributor

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>");
Copy link
Contributor

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 :)

@AxelPeter AxelPeter force-pushed the feature/oui-switch branch from 9b75473 to 77e0d06 Compare July 4, 2018 15:35
@AxelPeter AxelPeter merged commit d496e19 into develop Jul 4, 2018
@AxelPeter AxelPeter deleted the feature/oui-switch branch July 4, 2018 15:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Development

Successfully merging this pull request may close these issues.

4 participants