#Unexpected whitespace around list item text

3 messages · Page 1 of 1 (latest)

dull fractal
#

Hi! I am not sure if this is an Angular or an IDE thing.

I'm testing this list item, asserting that the text is** "Login", though it's failing saying it's " Login " **.

This list item is rendering with whitespace around the text (see screenshot). When I save, it auto formats the tags to new lines.

I'm curious if this is anything to do with Angular, or probably the IDE formatting?

This is how it's formatting it on save.
<li> Login </li>

earnest grove
#

Angular removes irrelevant white spaces. Since you still have one, it's your IDE. What does the code look like before you hit Save?
Anyway, since this white space is probably completely harmless, you could just relax your test and check that the trimmed text is "Login".

dull fractal
#

Well, I can write it like this:

    <li
      *ngIf="!isLoggedIn"
      (domChange)="onDomChange($event)"
      class="last"
      (click)="router.navigate(['/login'])"
    >Login</li>

And then it formats it with the tags on their own lines.