mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 13:01:01 +08:00
test(searchbar): searchbar + modal
This commit is contained in:
@ -135,7 +135,7 @@ export class Searchbar extends Ion {
|
|||||||
@Input() type: string = 'search';
|
@Input() type: string = 'search';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @input {string|boolean} Set the input's spellcheck property. Values: `true`, `false`. Default `false`.
|
* @input {string|boolean} Configures if the searchbar is animated or no. By default, animation is disabled.
|
||||||
*/
|
*/
|
||||||
@Input() animated: string | boolean = false;
|
@Input() animated: string | boolean = false;
|
||||||
|
|
||||||
@ -357,7 +357,7 @@ export class Searchbar extends Ion {
|
|||||||
this.ionClear.emit(ev);
|
this.ionClear.emit(ev);
|
||||||
|
|
||||||
// setTimeout() fixes https://github.com/driftyco/ionic/issues/7527
|
// setTimeout() fixes https://github.com/driftyco/ionic/issues/7527
|
||||||
// way for 4 frames
|
// wait for 4 frames
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let value = this._value;
|
let value = this._value;
|
||||||
if (isPresent(value) && value !== '') {
|
if (isPresent(value) && value !== '') {
|
||||||
@ -418,7 +418,7 @@ export class Searchbar extends Ion {
|
|||||||
this.onTouched = fn;
|
this.onTouched = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
focus() {
|
setFocus() {
|
||||||
this.getNativeElement().focus();
|
this._renderer.invokeElementMethod(this._searchbarInput.nativeElement, 'focus');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Component, NgModule } from '@angular/core';
|
import { Component, NgModule } from '@angular/core';
|
||||||
import { IonicApp, IonicModule, NavController, NavParams } from '../../../..';
|
import { IonicApp, IonicModule, ModalController, NavController, NavParams, ViewController } from '../../../..';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -13,13 +13,23 @@ export class MainPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: 'modal.html'
|
||||||
|
})
|
||||||
|
export class ModalPage {
|
||||||
|
constructor(public viewCtrl: ViewController) {}
|
||||||
|
close() {
|
||||||
|
this.viewCtrl.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'search.html'
|
templateUrl: 'search.html'
|
||||||
})
|
})
|
||||||
export class SearchPage {
|
export class SearchPage {
|
||||||
items: string[];
|
items: string[];
|
||||||
|
|
||||||
constructor(public navCtrl: NavController) {
|
constructor(public navCtrl: NavController, public modalCtrl: ModalController) {
|
||||||
this.initializeItems();
|
this.initializeItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +98,11 @@ export class SearchPage {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openModal() {
|
||||||
|
let modal = this.modalCtrl.create(ModalPage);
|
||||||
|
modal.present();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -121,6 +136,7 @@ export class E2EApp {
|
|||||||
E2EApp,
|
E2EApp,
|
||||||
MainPage,
|
MainPage,
|
||||||
SearchPage,
|
SearchPage,
|
||||||
|
ModalPage,
|
||||||
DetailPage,
|
DetailPage,
|
||||||
TabsPage
|
TabsPage
|
||||||
],
|
],
|
||||||
@ -132,6 +148,7 @@ export class E2EApp {
|
|||||||
E2EApp,
|
E2EApp,
|
||||||
MainPage,
|
MainPage,
|
||||||
SearchPage,
|
SearchPage,
|
||||||
|
ModalPage,
|
||||||
DetailPage,
|
DetailPage,
|
||||||
TabsPage
|
TabsPage
|
||||||
]
|
]
|
||||||
|
21
src/components/searchbar/test/nav/modal.html
Normal file
21
src/components/searchbar/test/nav/modal.html
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<ion-header>
|
||||||
|
<ion-toolbar>
|
||||||
|
<ion-buttons start>
|
||||||
|
<button ion-button >
|
||||||
|
Does nothing
|
||||||
|
</button>
|
||||||
|
</ion-buttons>
|
||||||
|
<ion-buttons end>
|
||||||
|
<button ion-button (click)="close()">
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</ion-buttons>
|
||||||
|
</ion-toolbar>
|
||||||
|
</ion-header>
|
||||||
|
|
||||||
|
<ion-content padding>
|
||||||
|
Close the modal with the button and the searchbar SHOULD NOT become focused.
|
||||||
|
<button ion-button (click)="close()">
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</ion-content>
|
@ -1,17 +1,19 @@
|
|||||||
<ion-header>
|
<ion-header>
|
||||||
|
|
||||||
<ion-navbar no-border-bottom>
|
<ion-navbar no-border-bottom>
|
||||||
<ion-title>Searchbar</ion-title>
|
<ion-searchbar color="primary" autofocus (ionInput)="getItems($event)" placeholder="Filter Schedules">
|
||||||
|
</ion-searchbar>
|
||||||
</ion-navbar>
|
</ion-navbar>
|
||||||
|
|
||||||
<ion-toolbar no-border-top>
|
<ion-toolbar no-border-top>
|
||||||
<ion-searchbar color="primary" (ionInput)="getItems($event)" placeholder="Filter Schedules">
|
<ion-title>Searchbar</ion-title>
|
||||||
</ion-searchbar>
|
<ion-buttons end>
|
||||||
|
<button ion-button (click)="openModal()">Open modal</button>
|
||||||
|
</ion-buttons>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
|
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
|
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<form>
|
<form>
|
||||||
|
Reference in New Issue
Block a user