chore(): sync with main

This commit is contained in:
Liam DeBeasi
2022-04-07 14:14:05 -04:00
55 changed files with 338 additions and 166 deletions

View File

@@ -43,7 +43,6 @@ describe('Modals', () => {
});
describe('Modals: Inline', () => {
beforeEach(() => {
cy.visit('/modal-inline');
@@ -92,3 +91,29 @@ describe('Modals: Inline', () => {
});
});
describe('when in a modal', () => {
beforeEach(() => {
cy.visit('/modals');
cy.get('#action-button').click();
cy.get('#close-modal').click();
cy.get('#action-button').click();
});
it('should render ion-item item-has-value class when control value is set', () => {
cy.get('[formControlName="select"]').invoke('attr', 'value', 0);
cy.get('#inputWithFloatingLabel').should('have.class', 'item-has-value');
});
it('should not render ion-item item-has-value class when control value is undefined', () => {
cy.get('[formControlName="select"]').invoke('attr', 'value', undefined);
cy.get('#inputWithFloatingLabel').should('not.have.class', 'item-has-value');
});
it('should not render ion-item item-has-value class when control value is null', () => {
cy.get('[formControlName="select"]').invoke('attr', 'value', null);
cy.get('#inputWithFloatingLabel').should('not.have.class', 'item-has-value');
});
});

View File

@@ -22,4 +22,14 @@
<ion-button (click)="push()" class="push-page">Push page</ion-button>
<ion-button (click)="pop()" class="pop-page">Pop page</ion-button>
</p>
<form [formGroup]="form">
<ion-item id="inputWithFloatingLabel">
<ion-label color="primary" position="floating">Floating Label</ion-label>
<ion-select multiple="false" formControlName="select">
<ion-select-option [value]="0">Option 0</ion-select-option>
<ion-select-option [value]="1">Option 1</ion-select-option>
</ion-select>
</ion-item>
</form>
</ion-content>

View File

@@ -1,4 +1,5 @@
import { Component, Input, NgZone, OnInit, Optional } from '@angular/core';
import { FormControl, FormGroup } from '@angular/forms';
import { ModalController, NavParams, IonNav, ViewWillLeave, ViewDidEnter, ViewDidLeave } from '@ionic/angular';
@Component({
@@ -9,6 +10,10 @@ export class ModalExampleComponent implements OnInit, ViewWillLeave, ViewDidEnte
@Input() value: string;
form = new FormGroup({
select: new FormControl([])
});
valueFromParams: string;
onInit = 0;
willEnter = 0;