Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should open when pressing Space', () => {
fixture.detectChanges();
expect(uiSuggest.isOpen).toBeFalsy();
fixture.detectChanges();
const display = fixture.debugElement.query(By.css('.display'));
display.nativeElement.dispatchEvent(
EventGenerator.keyUp(Key.Space),
);
expect(uiSuggest.isOpen).toBeTruthy();
});
it('should clear value if the user presses the SPACE key on the clear button', () => {
const input = fixture.debugElement.query(By.css('input'));
input.nativeElement.value = value;
input.nativeElement.dispatchEvent(EventGenerator.input());
fixture.detectChanges();
expect(search.value).not.toEqual('');
const clear = fixture.debugElement.query(By.css('.ui-grid-search-cancel'));
clear.nativeElement.dispatchEvent(EventGenerator.keyUp(Key.Space));
fixture.detectChanges();
expect(search.value).toEqual('');
});
describe('Event: sort change', () => {
beforeEach(() => {
fixture.detectChanges();
});
const SORT_KEY_EVENTS = [
EventGenerator.keyUp(Key.Enter),
EventGenerator.keyUp(Key.Space),
];
const SORT_TRANSITIONS = [
{
from: '',
to: 'asc',
},
{
from: 'asc',
to: 'desc',
},
{
from: 'desc',
to: '',
},
];