From d6b5d004a7ae34f6cd398da0f0b684e038d5a4f6 Mon Sep 17 00:00:00 2001 From: arlair Date: Sun, 10 Apr 2016 18:25:03 +0800 Subject: [PATCH] fix(components): fix todos for data-cycle-ui in some components --- src/button/Button.ts | 3 +-- src/input/Input.ts | 2 +- src/radio/Radio.ts | 3 +-- src/radio/RadioButton.ts | 3 +-- src/radio/RadioGroup.ts | 5 ++--- 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/button/Button.ts b/src/button/Button.ts index 4576cd8..df9a457 100644 --- a/src/button/Button.ts +++ b/src/button/Button.ts @@ -60,9 +60,8 @@ export function ButtonFactory(sources: any, props$: Observable, [style.inverse]: props.inverse }, props.className); - //TODO: make an equivalent of data-react-toolbox='radio' for div? return ( - h(element, { props: { className } }, [ + h(element, { props: { className }, attrs: { 'data-cycle-ui': 'button' } }, [ //icon ? : null, //label: props.label // , diff --git a/src/input/Input.ts b/src/input/Input.ts index b302fa6..3cbdefa 100644 --- a/src/input/Input.ts +++ b/src/input/Input.ts @@ -86,7 +86,7 @@ export function InputFactory(sources: any, props$: Observable): Cycl // TODO: split input into a new function // TODO: make an equivalent of data-react-toolbox='input' for div? return ( - div( { props: { className: divClassName } }, [ + div( { props: { className: divClassName }, attrs: { 'data-cycle-ui': 'input' } }, [ h(props.multiline ? 'textarea' : 'input', { props: { className, diff --git a/src/radio/Radio.ts b/src/radio/Radio.ts index 5e216d9..728f4b7 100644 --- a/src/radio/Radio.ts +++ b/src/radio/Radio.ts @@ -31,9 +31,8 @@ function RadioFactory(sources: any, props$: Observable): CycleDomCom const className = classNames(style[props.checked ? 'radio-checked' : 'radio'], props.className); - //TODO: make an equivalent of data-react-toolbox='radio' for div? return ( - div( { props: { className } } ) + div( { props: { className }, attrs: { 'data-cycle-ui': 'radio' } } ) ); }); diff --git a/src/radio/RadioButton.ts b/src/radio/RadioButton.ts index e50030b..ebbdfb9 100644 --- a/src/radio/RadioButton.ts +++ b/src/radio/RadioButton.ts @@ -65,10 +65,9 @@ function view(sources: any, state$: any) { const inputClassName = classNames('radioInput', style.input); //TODO: split input into a new function - //TODO: make an equivalent of data-react-toolbox='radio-button' for div? return ( div([ - label( { props: { className } }, [ + label( { props: { className }, attrs: { 'data-cycle-ui': 'radio-button' } }, [ input( { props: { className: inputClassName, //TODO: which version? diff --git a/src/radio/RadioGroup.ts b/src/radio/RadioGroup.ts index 694bfb3..433787c 100644 --- a/src/radio/RadioGroup.ts +++ b/src/radio/RadioGroup.ts @@ -3,8 +3,7 @@ const { div } = require('cycle-snabbdom'); import * as classNames from 'classnames'; import { RadioButton, RadioButtonProps } from './RadioButton'; /* tslint:disable: no-unused-variable */ -const style = require('react-toolbox/lib/radio/style'); -/* tslint:enable */ +const style = require('react-toolbox/lib/radio/style'); /* tslint:enable */ import { componentFactory } from '../helpers/componentFactory'; import { CycleDomComponent, CycleComponent, CycleUiComponentProps } from '../helpers/cycleDomInterfaces'; @@ -52,7 +51,7 @@ function RadioGroupFactory(sources: any, props$: Observable, const className = classNames('radioGroup', props.className); return ( - div( { props: { className } }, + div( { props: { className }, attrs: { 'data-cycle-ui': 'radio-group' } }, childrenDOMs ) );