From 43d8bbdd1214918f245ce0d75983f372493d080c Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Wed, 3 Aug 2016 12:33:20 -0400 Subject: [PATCH] test(select): add demo for the selected text references #7341 --- src/components/select/select.ts | 4 +- .../select/test/single-value/index.ts | 71 ++++++++++++------- .../select/test/single-value/main.html | 11 +++ 3 files changed, 60 insertions(+), 26 deletions(-) diff --git a/src/components/select/select.ts b/src/components/select/select.ts index 600b9216ea..990f2eefde 100644 --- a/src/components/select/select.ts +++ b/src/components/select/select.ts @@ -184,9 +184,9 @@ export class Select implements AfterContentInit, ControlValueAccessor, OnDestroy * @input {string} The interface the select should use: `action-sheet` or `alert`. Default: `alert`. */ @Input() interface: string = ''; - + /** - * @input {string} The selected text should be showen. + * @input {string} The text to display instead of the selected option's value. */ @Input() selectedText: string = ''; diff --git a/src/components/select/test/single-value/index.ts b/src/components/select/test/single-value/index.ts index af1967ffba..a7be593ef1 100644 --- a/src/components/select/test/single-value/index.ts +++ b/src/components/select/test/single-value/index.ts @@ -1,38 +1,57 @@ import {Component} from '@angular/core'; import {ionicBootstrap} from '../../../../../src'; +export interface Currency { + symbol: string; + code: string; + name: string; +} @Component({ templateUrl: 'main.html' }) class E2EPage { - musicAlertOpts: any; + musicAlertOpts: any = { + title: '1994 Music', + subTitle: 'Select your favorite', + cssClass: 'music-select' + }; gender: string; - gaming: string; - os: string; - music: string; - month: string; - year: string; - years: Array; - notification: string; - status: string; + gaming: string = ''; + os: string = 'win3.1'; + years: Array = [1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]; + music: string = null; + month: string = '12'; + year: string = '1994'; + notification: string = 'enable'; + status: string = "checked"; + + currencies: Currency[] = [ + { + symbol: '$', + code: 'USD', + name: 'US Dollar' + }, + { + symbol: '€', + code: 'EUR', + name: 'Euro' + }, + { + symbol: '£', + code: 'FKP', + name: 'Falkland Islands Pound' + }, + { + symbol: '¢', + code: 'GHS', + name: 'Ghana Cedi' + } + ]; + currency: Currency; constructor() { - this.gaming = ''; - this.os = 'win3.1'; - this.music = null; - this.month = '12'; - this.year = '1994'; - this.notification = 'enable'; - this.status = "checked"; - - this.years = [1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]; - - this.musicAlertOpts = { - title: '1994 Music', - subTitle: 'Select your favorite', - cssClass: 'music-select' - }; + this.currency = this.currencies[0]; } gamingCancel() { @@ -50,6 +69,10 @@ class E2EPage { resetGender() { this.gender = null; } + + selectedText() { + return this.currency.symbol; + } } diff --git a/src/components/select/test/single-value/main.html b/src/components/select/test/single-value/main.html index 4360f4b77a..ece0699a10 100644 --- a/src/components/select/test/single-value/main.html +++ b/src/components/select/test/single-value/main.html @@ -95,6 +95,15 @@ + + Currency + + + {{cur.symbol}} ({{cur.code}}) {{cur.name}} + + + +