Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleMentionComponent);
fixture.detectChanges();
textarea = fixture.debugElement.query(By.css('textarea')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
// LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW);
RIGHT_EVENT = createKeyboardEvent('keydown', RIGHT_ARROW);
fixture.detectChanges();
flush();
}));
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleMentionComponent);
fixture.detectChanges();
textarea = fixture.debugElement.query(By.css('textarea')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
// LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW);
RIGHT_EVENT = createKeyboardEvent('keydown', RIGHT_ARROW);
fixture.detectChanges();
flush();
}));
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleMentionComponent);
fixture.detectChanges();
textarea = fixture.debugElement.query(By.css('textarea')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
// LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW);
RIGHT_EVENT = createKeyboardEvent('keydown', RIGHT_ARROW);
fixture.detectChanges();
flush();
}));
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleMentionComponent);
fixture.detectChanges();
textarea = fixture.debugElement.query(By.css('textarea')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
// LEFT_EVENT = createKeyboardEvent('keydown', LEFT_ARROW);
RIGHT_EVENT = createKeyboardEvent('keydown', RIGHT_ARROW);
fixture.detectChanges();
flush();
}));
it('should apply changes when Enter keydown', () => {
const editButton = componentElement.querySelector('.ant-typography-edit');
editButton!.click();
fixture.detectChanges();
const textarea = componentElement.querySelector('textarea')!;
typeInElement('test', textarea);
fixture.detectChanges();
const event = createKeyboardEvent('keydown', ENTER, textarea);
testComponent.nzTypographyComponent.textEditRef.onEnter(event);
fixture.detectChanges();
expect(testComponent.str).toBe('test');
});
});
it('should remove checked when press backs', fakeAsync(() => {
treeSelect.nativeElement.click();
fixture.detectChanges();
testComponent.showSearch = true;
fixture.detectChanges();
flush();
const input = treeSelect.nativeElement.querySelector('input') as HTMLInputElement;
const BACKSPACE_EVENT = createKeyboardEvent('keydown', BACKSPACE, input);
treeSelectComponent.updateSelectedNodes();
fixture.detectChanges();
expect(treeSelectComponent.selectedNodes.length === 1).toBe(true);
treeSelectComponent.onKeyDownInput(BACKSPACE_EVENT);
fixture.detectChanges();
tick(200);
expect(treeSelectComponent.selectedNodes.length === 0).toBe(true);
treeSelectComponent.onKeyDownInput(BACKSPACE_EVENT);
fixture.detectChanges();
tick(200);
expect(treeSelectComponent.selectedNodes.length === 0).toBe(true);
}));
beforeEach(() => {
fixture = TestBed.createComponent(NzTestAutocompletePropertyComponent);
fixture.detectChanges();
input = fixture.debugElement.query(By.css('input')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
TAB_EVENT = createKeyboardEvent('keydown', TAB);
});
beforeEach(() => {
fixture = TestBed.createComponent(NzTestAutocompletePropertyComponent);
fixture.detectChanges();
input = fixture.debugElement.query(By.css('input')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
TAB_EVENT = createKeyboardEvent('keydown', TAB);
});
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleAutocompleteComponent);
fixture.detectChanges();
input = fixture.debugElement.query(By.css('input')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
fixture.componentInstance.trigger.openPanel();
fixture.detectChanges();
flush();
}));
beforeEach(fakeAsync(() => {
fixture = TestBed.createComponent(NzTestSimpleAutocompleteComponent);
fixture.detectChanges();
input = fixture.debugElement.query(By.css('input')).nativeElement;
DOWN_ARROW_EVENT = createKeyboardEvent('keydown', DOWN_ARROW);
UP_ARROW_EVENT = createKeyboardEvent('keydown', UP_ARROW);
ENTER_EVENT = createKeyboardEvent('keydown', ENTER);
fixture.componentInstance.trigger.openPanel();
fixture.detectChanges();
flush();
}));