Skip to content

Commit

Permalink
fix: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
f-necas committed Jul 26, 2023
1 parent ec535b8 commit cab7e52
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { MatAutocompleteModule } from '@angular/material/autocomplete'
import { MatIconModule } from '@angular/material/icon'
import { By } from '@angular/platform-browser'
import { of, throwError } from 'rxjs'
import { AutocompleteComponent } from './autocomplete.component'
import {
AutocompleteComponent,
AutocompleteItem,
} from './autocomplete.component'
import { UiWidgetsModule } from '@geonetwork-ui/ui/widgets'

describe('AutocompleteComponent', () => {
Expand Down Expand Up @@ -69,6 +72,14 @@ describe('AutocompleteComponent', () => {
expect(popup).toBeFalsy()
})
})
describe('when clicking a predefined button', () => {
beforeEach(() => {
component.updateInputValue({ title: 'cc' } as AutocompleteItem)
})
it('calls the action with object given as input', () => {
expect(component.action).toHaveBeenCalledWith('cc')
})
})
describe('when writing text with 2 chars or less', () => {
beforeEach(() => {
component.inputRef.nativeElement.value = 'bl'
Expand Down

0 comments on commit cab7e52

Please sign in to comment.