Skip to content
This repository has been archived by the owner on Apr 4, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into snyk-upgrade-b3910f96732cedbf219253b09a680c39
Browse files Browse the repository at this point in the history
  • Loading branch information
tboeckmann committed Feb 4, 2021
2 parents 7dfd484 + f803eec commit 008c701
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
13 changes: 13 additions & 0 deletions src/app/inbox/inbox-compose/inbox-compose.component.spec.ts
Expand Up @@ -291,6 +291,19 @@ describe('InboxComposeComponent', () => {
component.recipientResolve(event)
expect(component.currentRecipientValue).toEqual("alice.eth")
})
it('should trim whitespace from currentRecipientValue', () => {
let event = { target: { value: " alice.eth " } }

component.recipientResolve(event)
expect(component.currentRecipientValue).toEqual("alice.eth")
})
it('should trim whitespace from the call to recipientAddressChanged', () => {
let event = { target: { value: " alice.eth " } }
spyOn(component.recipientAddressChanged, 'next').and.callThrough()

component.recipientResolve(event)
expect(component.recipientAddressChanged.next).toHaveBeenCalledWith("alice.eth")
})
xit('should call the resolveAddress thru the private recipientAddressChanged subscription next function with the event.target.value', () => {
let event = { target: { value: "alice.eth" } }
spyOn(component, 'resolveAddress').and.callThrough()
Expand Down
12 changes: 7 additions & 5 deletions src/app/inbox/inbox-compose/inbox-compose.component.ts
Expand Up @@ -39,7 +39,7 @@ export class InboxComposeComponent implements OnInit {
private subscription
public currentRecipientValue

private recipientAddressChanged = new Subject<string>();
public recipientAddressChanged = new Subject<string>();
public recipientLoadingIcon = ""
public recipientLoadingText = ""
public messageToField = ""
Expand Down Expand Up @@ -136,17 +136,19 @@ export class InboxComposeComponent implements OnInit {
* @param event the event from keyup
*/
public recipientResolve(event) {
if (event.target.value == "") {
let eventVal = event.target.value.trim();
if (eventVal == "") {
this.setRecipientLoadingIcon("clear")
this.setRecipientLoadingText()
this.resetModelToField()
} else if (this.currentRecipientValue != event.target.value) {
} else if (this.currentRecipientValue != eventVal) {
this.setRecipientLoadingIcon("loading")
this.setRecipientLoadingText()
this.resetModelToField()
}
this.currentRecipientValue = event.target.value
this.recipientAddressChanged.next(event.target.value);
this.currentRecipientValue = eventVal
this.recipientAddressChanged.next(eventVal);

}

/**
Expand Down

0 comments on commit 008c701

Please sign in to comment.