From 42f6b1056f08bbf1dbcd29e569b44a6d7aae8f47 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 25 Jan 2016 22:46:18 -0600 Subject: [PATCH] fix(input): update input css/tests --- ionic/components/card/test/list/main.html | 21 ++- ionic/components/checkbox/checkbox.ios.scss | 2 +- ionic/components/checkbox/checkbox.md.scss | 8 +- ionic/components/checkbox/checkbox.ts | 5 +- ionic/components/input/input.scss | 15 +- .../input/test/fixed-inline-labels/index.ts | 2 +- .../input/test/fixed-inline-labels/main.html | 12 +- .../input/test/inline-labels/main.html | 3 +- .../input/test/placeholder-labels/main.html | 4 +- ionic/components/label/label.scss | 5 +- ionic/components/label/test/basic/main.html | 6 +- ionic/components/list/test/headers/main.html | 7 +- ionic/components/list/test/inset/main.html | 14 +- ionic/components/list/test/no-lines/main.html | 7 +- ionic/components/menu/test/basic/page1.html | 6 +- ionic/components/modal/test/basic/index.ts | 12 +- ionic/components/nav/test/basic/index.ts | 12 +- ionic/components/radio/radio-button.ts | 37 ++-- ionic/components/radio/radio-group.ts | 4 +- ...s~3d61141c0391dbefcc6565ad94ab918ba2fff603 | 167 ------------------ ionic/components/radio/radio-group.ts~HEAD | 167 ------------------ ionic/components/radio/radio.ios.scss | 12 +- ionic/components/radio/radio.md.scss | 17 +- ionic/components/radio/test/basic/e2e.ts | 2 +- ionic/components/select/select.ios.scss | 20 +++ ionic/components/select/select.md.scss | 24 +++ ionic/components/select/select.scss | 20 --- ionic/components/select/select.ts | 31 ++-- .../select/test/multiple-value/e2e.ts | 3 + .../select/test/multiple-value/main.html | 6 +- .../select/test/single-value/e2e.ts | 3 + .../select/test/single-value/main.html | 27 +-- ionic/components/tabs/test/advanced/index.ts | 12 +- ionic/components/toggle/test/basic/e2e.ts | 2 +- ionic/components/toggle/toggle.ios.scss | 2 +- ionic/components/toggle/toggle.md.scss | 14 +- ionic/components/toggle/toggle.ts | 1 + ionic/util/form.ts | 12 +- scripts/snapshot/snapshot.config.js | 2 +- 39 files changed, 214 insertions(+), 512 deletions(-) delete mode 100644 ionic/components/radio/radio-group.ts~3d61141c0391dbefcc6565ad94ab918ba2fff603 delete mode 100644 ionic/components/radio/radio-group.ts~HEAD diff --git a/ionic/components/card/test/list/main.html b/ionic/components/card/test/list/main.html index 69dd1f1614..11d77a3fb1 100644 --- a/ionic/components/card/test/list/main.html +++ b/ionic/components/card/test/list/main.html @@ -11,10 +11,11 @@ Card List - + - Wifi - + Wifi + + @@ -44,10 +45,11 @@ Card List Without Lines - + - Wifi - + Wifi + + @@ -75,10 +77,11 @@ Card With Items (No List) - + - Wifi - + Wifi + + diff --git a/ionic/components/checkbox/checkbox.ios.scss b/ionic/components/checkbox/checkbox.ios.scss index cc5c52a66b..cb209e9d1a 100644 --- a/ionic/components/checkbox/checkbox.ios.scss +++ b/ionic/components/checkbox/checkbox.ios.scss @@ -19,7 +19,7 @@ $checkbox-ios-icon-checkmark-color: $background-ios-color !default; $checkbox-ios-media-margin: $item-ios-padding-media-top $item-ios-padding-right $item-ios-padding-media-bottom 2px !default; -$checkbox-ios-disabled-opacity: 0.5 !default; +$checkbox-ios-disabled-opacity: 0.4 !default; // iOS Checkbox Outer Circle: Unchecked diff --git a/ionic/components/checkbox/checkbox.md.scss b/ionic/components/checkbox/checkbox.md.scss index fd752c0082..9beb24febf 100644 --- a/ionic/components/checkbox/checkbox.md.scss +++ b/ionic/components/checkbox/checkbox.md.scss @@ -9,7 +9,7 @@ $checkbox-md-border-bottom-color: $list-md-border-color !default; $checkbox-md-padding: $item-md-padding-top ($item-md-padding-right / 2) $item-md-padding-bottom 0 !default; $checkbox-md-margin: 0 !default; $checkbox-md-media-margin: $item-md-padding-media-top 36px $item-md-padding-media-bottom 4px !default; -$checkbox-md-disabled-opacity: 0.5 !default; +$checkbox-md-disabled-opacity: 0.4 !default; $checkbox-md-icon-background-color-off: $list-md-background-color !default; $checkbox-md-icon-background-color-on: map-get($colors-md, primary) !default; @@ -78,13 +78,17 @@ $checkbox-md-icon-border-color-on: map-get($colors-md, primary) !default; } -// Material Design Checkbox within an item +// Material Design Checkbox Within An Item // ----------------------------------------- .item ion-checkbox { margin: $checkbox-md-media-margin; } +ion-checkbox + .item-inner ion-label { + margin-left: 0; +} + // Material Design Checkbox Color Mixin // -------------------------------------------------- diff --git a/ionic/components/checkbox/checkbox.ts b/ionic/components/checkbox/checkbox.ts index 6c3e88d35b..8fe5cbb5ba 100644 --- a/ionic/components/checkbox/checkbox.ts +++ b/ionic/components/checkbox/checkbox.ts @@ -80,6 +80,7 @@ export class Checkbox { if (_item) { this.id = 'chk-' + _item.registerInput('checkbox'); this._labelId = 'lbl-' + _item.id; + this._item.setCssClass('item-checkbox', true); } } @@ -91,11 +92,11 @@ export class Checkbox { this.checked = !this.checked; } + @Input() get checked() { return this._checked; } - @Input() set checked(val) { if (!this._disabled) { this._checked = (val === true || val === 'true'); @@ -104,11 +105,11 @@ export class Checkbox { } } + @Input() get disabled() { return this._disabled; } - @Input() set disabled(val) { this._disabled = (val === true || val === 'true'); this._item && this._item.setCssClass('item-checkbox-disabled', this._disabled); diff --git a/ionic/components/input/input.scss b/ionic/components/input/input.scss index 7a1b4605ad..073a86aaec 100644 --- a/ionic/components/input/input.scss +++ b/ionic/components/input/input.scss @@ -1,14 +1,25 @@ @import "../../globals.core"; -// Input Wrapper +// Input/Textarea Wrapper // -------------------------------------------------- -ion-input { +ion-input, +ion-textarea { display: block; flex: 1; } + + +// Textarea Within An Item +// -------------------------------------------------- + +.item.item-textarea { + align-items: stretch; +} + + // Native Text Input // -------------------------------------------------- diff --git a/ionic/components/input/test/fixed-inline-labels/index.ts b/ionic/components/input/test/fixed-inline-labels/index.ts index 64c0c5fba8..82ea1a071b 100644 --- a/ionic/components/input/test/fixed-inline-labels/index.ts +++ b/ionic/components/input/test/fixed-inline-labels/index.ts @@ -8,6 +8,6 @@ class E2EApp { url; constructor() { - this.url = 'hello'; + this.input1 = 'Text 1'; } } diff --git a/ionic/components/input/test/fixed-inline-labels/main.html b/ionic/components/input/test/fixed-inline-labels/main.html index a30e7824dc..9efa8c1e44 100644 --- a/ionic/components/input/test/fixed-inline-labels/main.html +++ b/ionic/components/input/test/fixed-inline-labels/main.html @@ -9,12 +9,7 @@ To - - - - - Comments - + @@ -30,6 +25,11 @@ + + Comments + + + Website diff --git a/ionic/components/input/test/inline-labels/main.html b/ionic/components/input/test/inline-labels/main.html index 4023fac880..dc63ee9a65 100644 --- a/ionic/components/input/test/inline-labels/main.html +++ b/ionic/components/input/test/inline-labels/main.html @@ -90,9 +90,8 @@ No List - + - diff --git a/ionic/components/input/test/placeholder-labels/main.html b/ionic/components/input/test/placeholder-labels/main.html index 4cd04dd75d..6e88fad731 100644 --- a/ionic/components/input/test/placeholder-labels/main.html +++ b/ionic/components/input/test/placeholder-labels/main.html @@ -27,11 +27,11 @@ - + - ion-textarea value + diff --git a/ionic/components/label/label.scss b/ionic/components/label/label.scss index 2dee89d730..5add0dd4e1 100644 --- a/ionic/components/label/label.scss +++ b/ionic/components/label/label.scss @@ -9,10 +9,6 @@ ion-label { white-space: nowrap; } -ion-label:empty { - display: none; -} - .item-input ion-label { max-width: 200px; @@ -24,6 +20,7 @@ ion-label:empty { // -------------------------------------------------- ion-label[fixed] { + flex: 0; width: 30%; min-width: 100px; max-width: 200px; diff --git a/ionic/components/label/test/basic/main.html b/ionic/components/label/test/basic/main.html index bb59e2c46c..b57fb20282 100644 --- a/ionic/components/label/test/basic/main.html +++ b/ionic/components/label/test/basic/main.html @@ -5,9 +5,9 @@ - + Username - - + + diff --git a/ionic/components/list/test/headers/main.html b/ionic/components/list/test/headers/main.html index da6ad7365a..789386ccfb 100644 --- a/ionic/components/list/test/headers/main.html +++ b/ionic/components/list/test/headers/main.html @@ -8,10 +8,11 @@ List Header - + - Wifi - + Wifi + + diff --git a/ionic/components/list/test/inset/main.html b/ionic/components/list/test/inset/main.html index d05096a5f0..0cae93c95e 100644 --- a/ionic/components/list/test/inset/main.html +++ b/ionic/components/list/test/inset/main.html @@ -20,13 +20,15 @@ List Link Item 2 - - Toggle - + + Toggle + + - - Checkbox - + + Checkbox + + diff --git a/ionic/components/nav/test/basic/index.ts b/ionic/components/nav/test/basic/index.ts index 9a59853291..a35b075d84 100644 --- a/ionic/components/nav/test/basic/index.ts +++ b/ionic/components/nav/test/basic/index.ts @@ -33,10 +33,10 @@ class MyCmpTest{} - + Text Input - - + + @@ -218,10 +218,10 @@ class PrimaryHeaderPage { - + Text Input - - + + Back button hidden w/ ion-navbar hideBackButton diff --git a/ionic/components/radio/radio-button.ts b/ionic/components/radio/radio-button.ts index ff2a29246f..1836a42018 100644 --- a/ionic/components/radio/radio-button.ts +++ b/ionic/components/radio/radio-button.ts @@ -9,17 +9,22 @@ import {RadioGroup} from './radio-group'; /** * @description - * A radio button with a unique value. Note that all `` components - * must be wrapped within a ``, and there must be at - * least two `` components within the radio group. + * A radio button with a unique value. Note that all `` + * components must be wrapped within a ``, + * and there must be at least two `` components within + * the radio group. * - * See the [Angular 2 Docs](https://angular.io/docs/js/latest/api/forms/) for more info on forms and input. + * See the [Angular 2 Docs](https://angular.io/docs/js/latest/api/forms/) for + * more info on forms and input. * * @usage * ```html - * - * Radio Label - * + * + * + * Radio Label + * + * + * * ``` * @demo /docs/v2/demos/radio/ * @see {@link /docs/v2/components#radio Radio Component Docs} @@ -61,6 +66,7 @@ export class RadioButton { if (_item) { this.id = 'rb-' + _item.registerInput('radio'); this._labelId = 'lbl-' + _item.id; + this._item.setCssClass('item-radio', true); } if (_group) { @@ -78,16 +84,11 @@ export class RadioButton { } set checked(val) { -<<<<<<< HEAD if (!this._disabled) { this._checked = (val === true || val === 'true'); this.select.emit(this); this._item && this._item.setCssClass('item-radio-checked', this._checked); } -======= - this._checked = (val === true || val === 'true'); - this.select.emit(this); ->>>>>>> 581c666... refactor(radio): place ion-radio insde of ion-item } @Input() @@ -97,11 +98,7 @@ export class RadioButton { set disabled(val) { this._disabled = (val === true || val === 'true'); -<<<<<<< HEAD this._item && this._item.setCssClass('item-radio-disabled', this._disabled); -======= - this._item && this._item.setCssClass('radio-disabled', val); ->>>>>>> 581c666... refactor(radio): place ion-radio insde of ion-item } /** @@ -109,11 +106,7 @@ export class RadioButton { */ setChecked(val: boolean) { this._checked = val; -<<<<<<< HEAD this._item && this._item.setCssClass('item-radio-checked', val); -======= - this._item && this._item.setCssClass('radio-checked', val); ->>>>>>> 581c666... refactor(radio): place ion-radio insde of ion-item } /** @@ -121,11 +114,7 @@ export class RadioButton { */ @HostListener('click', ['$event']) private _click(ev) { -<<<<<<< HEAD console.debug('radio, select', this.value); -======= - console.debug('RadioButton, select', this.value); ->>>>>>> 581c666... refactor(radio): place ion-radio insde of ion-item ev.preventDefault(); ev.stopPropagation(); this.toggle(); diff --git a/ionic/components/radio/radio-group.ts b/ionic/components/radio/radio-group.ts index b739ae2577..4cf5a21964 100644 --- a/ionic/components/radio/radio-group.ts +++ b/ionic/components/radio/radio-group.ts @@ -8,14 +8,14 @@ import {isDefined} from '../../util/util'; /** * A radio group is a group of radio components, and its value comes - * fr0m the selected radio button's value. Selecting a radio button + * from the selected radio button's value. Selecting a radio button * in the group unselects all others in the group. * * See the [Angular 2 Docs](https://angular.io/docs/js/latest/api/forms/) for more info on forms and input. * * @usage * ```html - * + * * * * Auto Manufacturers diff --git a/ionic/components/radio/radio-group.ts~3d61141c0391dbefcc6565ad94ab918ba2fff603 b/ionic/components/radio/radio-group.ts~3d61141c0391dbefcc6565ad94ab918ba2fff603 deleted file mode 100644 index b739ae2577..0000000000 --- a/ionic/components/radio/radio-group.ts~3d61141c0391dbefcc6565ad94ab918ba2fff603 +++ /dev/null @@ -1,167 +0,0 @@ -import {Directive, ElementRef, Renderer, Optional, Input, Output, ContentChild, EventEmitter} from 'angular2/core'; -import {NgControl} from 'angular2/common'; - -import {RadioButton} from './radio-button'; -import {ListHeader} from '../list/list'; -import {isDefined} from '../../util/util'; - - -/** - * A radio group is a group of radio components, and its value comes - * fr0m the selected radio button's value. Selecting a radio button - * in the group unselects all others in the group. - * - * See the [Angular 2 Docs](https://angular.io/docs/js/latest/api/forms/) for more info on forms and input. - * - * @usage - * ```html - * - * - * - * Auto Manufacturers - * - * - * - * Cord - * - * - * - * - * Duesenberg - * - * - * - * - * Hudson - * - * - * - * - * Packard - * - * - * - * - * Studebaker - * - * - * - * - * ``` - * @demo /docs/v2/demos/radio/ - * @see {@link /docs/v2/components#radio Radio Component Docs} -*/ -@Directive({ - selector: '[radio-group]', - host: { - '[attr.aria-activedescendant]': 'activeId', - 'role': 'radiogroup' - } -}) -export class RadioGroup { - private _buttons: Array = []; - - id; - value; - - @Output() change: EventEmitter = new EventEmitter(); - - constructor( - @Optional() ngControl: NgControl, - private _renderer: Renderer, - private _elementRef: ElementRef - ) { - this.id = ++radioGroupIds; - - if (ngControl) { - ngControl.valueAccessor = this; - } - } - - /** - * @private - * Angular2 Forms API method called by the model (Control) on change to update - * the checked value. - * https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L34 - */ - writeValue(value) { - this.value = isDefined(value) ? value : ''; - this._buttons.forEach(button => { - let isChecked = (button.value === this.value); - button.setChecked(isChecked); - if (isChecked) { - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-activedescendant', button.id); - } - }); - } - - register(button: RadioButton) { - this._buttons.push(button); - - button.select.subscribe(() => { - this.writeValue(button.value); - this.onChange(button.value); - this.change.emit(this); - }); - } - - ngAfterContentInit() { - this._buttons.forEach(button => { - - if (isDefined(this.value)) { - let isChecked = (button.value === this.value) || button.checked; - button.setChecked(isChecked); - if (isChecked) { - this.writeValue(button.value); - //this.onChange(button.value); - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-activedescendant', button.id); - } - } - - }); - } - - @ContentChild(ListHeader) - private set _header(header) { - if (header) { - if (!header.id) { - header.id = 'rg-hdr-' + this.id; - } - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-describedby', header.id); - } - } - - /** - * @private - */ - onChange(val) { - // TODO: figure the whys and the becauses - } - - /** - * @private - */ - onTouched(val) { - // TODO: figure the whys and the becauses - } - - /** - * @private - * Angular2 Forms API method called by the view (NgControl) to register the - * onChange event handler that updates the model (Control). - * https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L27 - * @param {Function} fn the onChange event handler. - */ - registerOnChange(fn) { this.onChange = fn; } - - /** - * @private - * Angular2 Forms API method called by the the view (NgControl) to register - * the onTouched event handler that marks the model (Control) as touched. - * @param {Function} fn onTouched event handler. - */ - registerOnTouched(fn) { this.onTouched = fn; } - -} - -let radioGroupIds = -1; diff --git a/ionic/components/radio/radio-group.ts~HEAD b/ionic/components/radio/radio-group.ts~HEAD deleted file mode 100644 index b739ae2577..0000000000 --- a/ionic/components/radio/radio-group.ts~HEAD +++ /dev/null @@ -1,167 +0,0 @@ -import {Directive, ElementRef, Renderer, Optional, Input, Output, ContentChild, EventEmitter} from 'angular2/core'; -import {NgControl} from 'angular2/common'; - -import {RadioButton} from './radio-button'; -import {ListHeader} from '../list/list'; -import {isDefined} from '../../util/util'; - - -/** - * A radio group is a group of radio components, and its value comes - * fr0m the selected radio button's value. Selecting a radio button - * in the group unselects all others in the group. - * - * See the [Angular 2 Docs](https://angular.io/docs/js/latest/api/forms/) for more info on forms and input. - * - * @usage - * ```html - * - * - * - * Auto Manufacturers - * - * - * - * Cord - * - * - * - * - * Duesenberg - * - * - * - * - * Hudson - * - * - * - * - * Packard - * - * - * - * - * Studebaker - * - * - * - * - * ``` - * @demo /docs/v2/demos/radio/ - * @see {@link /docs/v2/components#radio Radio Component Docs} -*/ -@Directive({ - selector: '[radio-group]', - host: { - '[attr.aria-activedescendant]': 'activeId', - 'role': 'radiogroup' - } -}) -export class RadioGroup { - private _buttons: Array = []; - - id; - value; - - @Output() change: EventEmitter = new EventEmitter(); - - constructor( - @Optional() ngControl: NgControl, - private _renderer: Renderer, - private _elementRef: ElementRef - ) { - this.id = ++radioGroupIds; - - if (ngControl) { - ngControl.valueAccessor = this; - } - } - - /** - * @private - * Angular2 Forms API method called by the model (Control) on change to update - * the checked value. - * https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L34 - */ - writeValue(value) { - this.value = isDefined(value) ? value : ''; - this._buttons.forEach(button => { - let isChecked = (button.value === this.value); - button.setChecked(isChecked); - if (isChecked) { - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-activedescendant', button.id); - } - }); - } - - register(button: RadioButton) { - this._buttons.push(button); - - button.select.subscribe(() => { - this.writeValue(button.value); - this.onChange(button.value); - this.change.emit(this); - }); - } - - ngAfterContentInit() { - this._buttons.forEach(button => { - - if (isDefined(this.value)) { - let isChecked = (button.value === this.value) || button.checked; - button.setChecked(isChecked); - if (isChecked) { - this.writeValue(button.value); - //this.onChange(button.value); - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-activedescendant', button.id); - } - } - - }); - } - - @ContentChild(ListHeader) - private set _header(header) { - if (header) { - if (!header.id) { - header.id = 'rg-hdr-' + this.id; - } - this._renderer.setElementAttribute(this._elementRef.nativeElement, 'aria-describedby', header.id); - } - } - - /** - * @private - */ - onChange(val) { - // TODO: figure the whys and the becauses - } - - /** - * @private - */ - onTouched(val) { - // TODO: figure the whys and the becauses - } - - /** - * @private - * Angular2 Forms API method called by the view (NgControl) to register the - * onChange event handler that updates the model (Control). - * https://github.com/angular/angular/blob/master/modules/angular2/src/forms/directives/shared.ts#L27 - * @param {Function} fn the onChange event handler. - */ - registerOnChange(fn) { this.onChange = fn; } - - /** - * @private - * Angular2 Forms API method called by the the view (NgControl) to register - * the onTouched event handler that marks the model (Control) as touched. - * @param {Function} fn onTouched event handler. - */ - registerOnTouched(fn) { this.onTouched = fn; } - -} - -let radioGroupIds = -1; diff --git a/ionic/components/radio/radio.ios.scss b/ionic/components/radio/radio.ios.scss index 0629c97994..2854b80f8d 100644 --- a/ionic/components/radio/radio.ios.scss +++ b/ionic/components/radio/radio.ios.scss @@ -10,7 +10,7 @@ $radio-ios-icon-height: 21px !default; $radio-ios-icon-border-width: 2px !default; $radio-ios-icon-border-style: solid !default; -$radio-ios-disabled-opacity: 0.5 !default; +$radio-ios-disabled-opacity: 0.4 !default; // iOS Radio Circle: Unchecked @@ -32,10 +32,10 @@ $radio-ios-disabled-opacity: 0.5 !default; border-width: $radio-ios-icon-border-width; border-style: $radio-ios-icon-border-style; border-color: $radio-ios-color-on; - top: 3px; + top: 4px; left: 7px; - width: 4px; - height: 10px; + width: 5px; + height: 12px; border-left: none; border-top: none; transform: rotate(45deg); @@ -60,6 +60,10 @@ $radio-ios-disabled-opacity: 0.5 !default; margin: $item-ios-padding-media-top ($item-ios-padding-right / 2) $item-ios-padding-media-bottom ($item-ios-padding-left / 2); } +.item-radio ion-label { + margin-left: 0; +} + // iOS Radio Item Label: Checked // ----------------------------------------- diff --git a/ionic/components/radio/radio.md.scss b/ionic/components/radio/radio.md.scss index 2b2c876e87..ff1d51139f 100644 --- a/ionic/components/radio/radio.md.scss +++ b/ionic/components/radio/radio.md.scss @@ -15,7 +15,7 @@ $radio-md-icon-border-radius: 50% !default; $radio-md-transition-duration: 280ms !default; $radio-md-transition-easing: cubic-bezier(.4, 0, .2, 1) !default; -$radio-md-disabled-opacity: 0.5 !default; +$radio-md-disabled-opacity: 0.4 !default; // Material Design Radio Outer Circle: Unchecked @@ -83,7 +83,11 @@ $radio-md-disabled-opacity: 0.5 !default; .item ion-radio { display: block; - margin: $item-md-padding-media-top ($item-md-padding-right / 2) $item-md-padding-media-bottom ($item-md-padding-left / 2); + margin: $item-md-padding-media-top ($item-md-padding-right / 2) $item-md-padding-media-bottom 0; +} + +.item-radio ion-label { + margin-left: 0; } @@ -100,10 +104,13 @@ $radio-md-disabled-opacity: 0.5 !default; @mixin radio-theme-md($color-name, $color-value) { - ion-radio[#{$color-name}] .radio-checked { - border-color: $color-value; + ion-radio[#{$color-name}] { - .radio-icon { + .radio-checked { + border-color: $color-value; + } + + .radio-inner { background-color: $color-value; } diff --git a/ionic/components/radio/test/basic/e2e.ts b/ionic/components/radio/test/basic/e2e.ts index dab19b790f..824806e17a 100644 --- a/ionic/components/radio/test/basic/e2e.ts +++ b/ionic/components/radio/test/basic/e2e.ts @@ -1,4 +1,4 @@ it('should check Cherry', function() { - element(by.css('.e2eCherry button')).click(); + element(by.css('[value="cherry"] button')).click(); }); diff --git a/ionic/components/select/select.ios.scss b/ionic/components/select/select.ios.scss index e77bdd8b26..b8ed48cf1b 100644 --- a/ionic/components/select/select.ios.scss +++ b/ionic/components/select/select.ios.scss @@ -12,4 +12,24 @@ $select-ios-padding-left: $item-ios-padding-left !default; ion-select { padding: $select-ios-padding-top $select-ios-padding-right $select-ios-padding-bottom $select-ios-padding-left; +} + +.select-icon { + position: relative; + width: 12px; + height: 18px; +} + +.select-icon .select-icon-inner { + position: absolute; + top: 50%; + left: 5px; + margin-top: -2px; + width: 0; + height: 0; + border-top: 5px solid; + border-right: 5px solid transparent; + border-left: 5px solid transparent; + color: #999; + pointer-events: none; } \ No newline at end of file diff --git a/ionic/components/select/select.md.scss b/ionic/components/select/select.md.scss index ce790331cd..72b32f71a6 100644 --- a/ionic/components/select/select.md.scss +++ b/ionic/components/select/select.md.scss @@ -12,4 +12,28 @@ $select-md-padding-left: $item-md-padding-left !default; ion-select { padding: $select-md-padding-top $select-md-padding-right $select-md-padding-bottom $select-md-padding-left; +} + +.item-select ion-label { + margin-left: 0; +} + +.select-icon { + position: relative; + width: 12px; + height: 19px; +} + +.select-icon .select-icon-inner { + position: absolute; + top: 50%; + left: 5px; + margin-top: -3px; + width: 0; + height: 0; + border-top: 5px solid; + border-right: 5px solid transparent; + border-left: 5px solid transparent; + color: #999; + pointer-events: none; } \ No newline at end of file diff --git a/ionic/components/select/select.scss b/ionic/components/select/select.scss index f478e5eb54..a334c8381e 100644 --- a/ionic/components/select/select.scss +++ b/ionic/components/select/select.scss @@ -18,26 +18,6 @@ ion-select { text-overflow: ellipsis; } -.select-icon { - position: relative; - width: 16px; - height: 16px; -} - -.select-icon .select-icon-inner { - position: absolute; - top: 50%; - left: 5px; - margin-top: -2px; - width: 0; - height: 0; - border-top: 5px solid; - border-right: 5px solid transparent; - border-left: 5px solid transparent; - color: #999; - pointer-events: none; -} - .item-multiple-inputs ion-select { position: relative; } \ No newline at end of file diff --git a/ionic/components/select/select.ts b/ionic/components/select/select.ts index cd2743de86..2ec0190ff9 100644 --- a/ionic/components/select/select.ts +++ b/ionic/components/select/select.ts @@ -4,7 +4,7 @@ import {NgControl} from 'angular2/common'; import {Alert} from '../alert/alert'; import {Form} from '../../util/form'; import {Item} from '../item/item'; -import {merge} from '../../util/util'; +import {merge, isDefined} from '../../util/util'; import {NavController} from '../nav/nav-controller'; import {Option} from '../option/option'; @@ -143,6 +143,7 @@ export class Select { if (_item) { this.id = 'sel-' + _item.registerInput('select'); this._labelId = 'lbl-' + _item.id; + this._item.setCssClass('item-select', true); } if (!_nav) { @@ -154,24 +155,22 @@ export class Select { * @private */ ngAfterContentInit() { - var selectedOption = this.options.toArray().find(o => o.checked); + let values = []; + let selectedTexts = []; - if (!selectedOption) { - this.options.toArray().forEach(o => { - o.checked = o.value === this.value + ''; - if (o.checked) { - selectedOption = o; - } - }); + this.options.toArray().forEach(option => { + if (option.checked) { + values.push( isDefined(option.value) ? option.value : option.text ); + selectedTexts.push(option.text); + } + }); - } else { - this.value = selectedOption.value; - this._selectedText = selectedOption.text; + this.value = values.join(','); + this._selectedText = selectedTexts.join(', '); - setTimeout(()=> { - this.onChange(this.value); - }); - } + setTimeout(()=> { + this.onChange(this.value); + }); } /** diff --git a/ionic/components/select/test/multiple-value/e2e.ts b/ionic/components/select/test/multiple-value/e2e.ts index 8b13789179..48f1324e4a 100644 --- a/ionic/components/select/test/multiple-value/e2e.ts +++ b/ionic/components/select/test/multiple-value/e2e.ts @@ -1 +1,4 @@ +it('should open toppings multiple select', function() { + element(by.css('.e2eSelectToppings button')).click(); +}); \ No newline at end of file diff --git a/ionic/components/select/test/multiple-value/main.html b/ionic/components/select/test/multiple-value/main.html index 6a3ca4799b..9002cdefc2 100644 --- a/ionic/components/select/test/multiple-value/main.html +++ b/ionic/components/select/test/multiple-value/main.html @@ -6,10 +6,10 @@ Toppings - - Bacon + + Bacon Black Olives - Extra Cheese + Extra Cheese Green Peppers Mushrooms Onions diff --git a/ionic/components/select/test/single-value/e2e.ts b/ionic/components/select/test/single-value/e2e.ts index 8b13789179..03954febef 100644 --- a/ionic/components/select/test/single-value/e2e.ts +++ b/ionic/components/select/test/single-value/e2e.ts @@ -1 +1,4 @@ +it('should open gender single select', function() { + element(by.css('.e2eSelectGender button')).click(); +}); \ No newline at end of file diff --git a/ionic/components/select/test/single-value/main.html b/ionic/components/select/test/single-value/main.html index 20a61c3425..d00ef386c6 100644 --- a/ionic/components/select/test/single-value/main.html +++ b/ionic/components/select/test/single-value/main.html @@ -1,10 +1,12 @@ -Select Item: Single Value + + Select Item: Single Value + Gender - + Female Male @@ -38,15 +40,13 @@ Music - Alice in Chains - Green Day - Hole - Korn - Nirvana - Pearl Jam - Smashing Pumpkins - Soundgarden - Stone Temple Pilots + Alice in Chains + Green Day + Nirvana + Pearl Jam + Smashing Pumpkins + Soundgarden + Stone Temple Pilots @@ -60,11 +60,11 @@ May June July - August + August September October November - December + December 1989 @@ -86,6 +86,7 @@ gaming: {{gaming}}
os: {{os}}
music: {{music}}
+ date: {{month}}/{{year}}

diff --git a/ionic/components/tabs/test/advanced/index.ts b/ionic/components/tabs/test/advanced/index.ts index f08a84a390..f8786ce6fd 100644 --- a/ionic/components/tabs/test/advanced/index.ts +++ b/ionic/components/tabs/test/advanced/index.ts @@ -11,14 +11,14 @@ import {App, Page, NavController, Modal, ViewController, Tabs} from 'ionic/ionic - + Username: - - - + +
+ Password: - - + + diff --git a/ionic/components/toggle/test/basic/e2e.ts b/ionic/components/toggle/test/basic/e2e.ts index efb5b33089..019e051d17 100644 --- a/ionic/components/toggle/test/basic/e2e.ts +++ b/ionic/components/toggle/test/basic/e2e.ts @@ -1,6 +1,6 @@ it('should check apple via switch element click', function() { - element(by.css('[ngControl=appleCtrl] .toggle-media')).click(); + element(by.css('[value="apple"] button')).click(); }); diff --git a/ionic/components/toggle/toggle.ios.scss b/ionic/components/toggle/toggle.ios.scss index 53581057c1..0ce271c984 100644 --- a/ionic/components/toggle/toggle.ios.scss +++ b/ionic/components/toggle/toggle.ios.scss @@ -25,7 +25,7 @@ $toggle-ios-media-padding: 6px ($item-ios-padding-right / 2) 5px ($i $toggle-ios-transition-duration: 300ms !default; -$toggle-ios-disabled-opacity: 0.5 !default; +$toggle-ios-disabled-opacity: 0.4 !default; // iOS Toggle diff --git a/ionic/components/toggle/toggle.md.scss b/ionic/components/toggle/toggle.md.scss index 3f609ae79d..0aff152d20 100644 --- a/ionic/components/toggle/toggle.md.scss +++ b/ionic/components/toggle/toggle.md.scss @@ -22,7 +22,7 @@ $toggle-md-media-padding: 12px ($item-md-padding-right / 2) 12px $toggle-md-transition-duration: 300ms !default; -$toggle-md-disabled-opacity: 0.5 !default; +$toggle-md-disabled-opacity: 0.4 !default; // Material Design Toggle @@ -101,7 +101,7 @@ ion-toggle { } -// Material Design Toggle within an item +// Material Design Toggle Within An Item // ----------------------------------------- .item ion-toggle { @@ -110,14 +110,8 @@ ion-toggle { cursor: pointer; } - -// Material Design Toggle Within An Item -// ----------------------------------------- - -.item ion-toggle { - margin: $toggle-md-media-margin; - padding: $toggle-md-media-padding; - cursor: pointer; +.item-toggle ion-label { + margin-left: 0; } diff --git a/ionic/components/toggle/toggle.ts b/ionic/components/toggle/toggle.ts index 051f600c7f..e1a281743d 100644 --- a/ionic/components/toggle/toggle.ts +++ b/ionic/components/toggle/toggle.ts @@ -106,6 +106,7 @@ export class Toggle { if (_item) { this.id = 'tgl-' + _item.registerInput('toggle'); this._labelId = 'lbl-' + _item.id; + this._item.setCssClass('item-toggle', true); } } diff --git a/ionic/util/form.ts b/ionic/util/form.ts index b3df421c81..d460d2f3ca 100644 --- a/ionic/util/form.ts +++ b/ionic/util/form.ts @@ -2,17 +2,9 @@ import {Injectable} from 'angular2/core'; /** - * The Input component is used to focus text input elements. - * - * @usage - * ```html - * - * Name - * - * - * ``` + * @private */ - @Injectable() +@Injectable() export class Form { private _blur: HTMLElement; private _focused = null; diff --git a/scripts/snapshot/snapshot.config.js b/scripts/snapshot/snapshot.config.js index 22e81b8977..d6a67d99cf 100644 --- a/scripts/snapshot/snapshot.config.js +++ b/scripts/snapshot/snapshot.config.js @@ -9,7 +9,7 @@ exports.config = { //domain: 'localhost:8080', //specs: 'dist/e2e/**/*e2e.js', - specs: 'dist/e2e/checkbox/**/*e2e.js', + specs: 'dist/e2e/input/**/*e2e.js', sleepBetweenSpecs: 350,