Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48986

No input element inside ion-input when testing

$
0
0

I have a simple form with two fields: username and email. My test looks like this:

...
fit('should create', () => {
    console.log(fixture.debugElement.nativeElement.childNodes);
    expect(component).toBeTruthy();
  });
....

I just added console.log to generated spec file. As you can see from the output below the ion-input elements do not contain input element. Do you know why? (I need it to run blur handler that is attached to input)

LOG: NodeList{0: <form _ngcontent-a-c0="" novalidate="" ng-reflect-form="[object Object]" class="ng-untouched ng-pristine ng-invalid"><div _ngcontent-a-c0=""><!--bindings={
  "ng-reflect-ng-if": "false"
}--><ion-item _ngcontent-a-c0="" class="ion-untouched ion-pristine ion-invalid"><!--bindings={
  "ng-reflect-ng-if": "true"
}--><ion-label _ngcontent-a-c0="" color="medium" position="floating" ng-reflect-color="medium" ng-reflect-position="floating">Username</ion-label><!--bindings={
  "ng-reflect-ng-if": "false"
}--><!--bindings={
  "ng-reflect-ng-if": "false"
}--><!--bindings={
  "ng-reflect-ng-if": "false"
}--><!--bindings={
  "ng-reflect-ng-if": "false"
}--><!--bindings={
  "ng-reflect-ng-if": "false"
}--><ion-input _ngcontent-a-c0="" formcontrolname="username" type="text" ng-reflect-type="text" ng-reflect-name="username" class="ng-untouched ng-pristine ng-invalid ion-untouched ion-pristine ion-invalid"></ion-input></ion-item><ion-item _ngcontent-a-c0="" class="ion-untouched ion-pristine ion-valid"><!--bindings={
  "ng-reflect-ng-if": "true"
}--><ion-label _ngcontent-a-c0="" color="medium" position="floating" ng-reflect-color="medium" ng-reflect-position="floating">Email</ion-label><!--bindings={
  "ng-reflect-ng-if": "false"
}--><ion-input _ngcontent-a-c0="" formcontrolname="email" readonly="true" type="email" ng-reflect-readonly="true" ng-reflect-type="email" ng-reflect-name="email" class="ng-untouched ng-pristine ng-valid ion-untouched ion-pristine ion-valid"></ion-input></ion-item><ion-input _ngcontent-a-c0="" formcontrolname="token" type="hidden" ng-reflect-type="hidden" ng-reflect-name="token" class="ng-untouched ng-pristine ng-invalid ion-untouched ion-pristine ion-invalid"></ion-input></div><div _ngcontent-a-c0="" class="ion-padding-top"><ion-button _ngcontent-a-c0="" expand="block" size="large" type="submit" ng-reflect-disabled="true" ng-reflect-expand="block" ng-reflect-size="large" ng-reflect-type="submit">Register</ion-button></div></form>}

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48986

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>