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 clear value if the user presses the ENTER 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.Enter));
fixture.detectChanges();
expect(search.value).toEqual('');
});
});
it('should increment positively if DIRECTION is DOWN and NAVIGATING DOWN', () => {
component.direction = 'down';
fixture.detectChanges();
const display = fixture.debugElement.query(By.css('.display'));
display.nativeElement.dispatchEvent(
EventGenerator.keyDown(Key.Enter),
);
const itemContainer = fixture.debugElement.query(By.css('.item-list-container'));
itemContainer.nativeElement.dispatchEvent(
EventGenerator.keyDown(Key.ArrowDown),
);
expect(uiSuggest.activeIndex).toEqual(1);
});
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: '',
},