mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Create dynamic tag test events with key chars, not keyCodes
(cherry picked from commit 98fc76d867
)
This commit is contained in:

committed by
github-actions[bot]
![github-actions[bot]](/assets/img/avatar_default.png)
parent
1ade04398a
commit
86a18f31d9
@@ -22,10 +22,10 @@ import {
|
|||||||
mockDynamicFormValidationService
|
mockDynamicFormValidationService
|
||||||
} from '../../../../../testing/dynamic-form-mock-services';
|
} from '../../../../../testing/dynamic-form-mock-services';
|
||||||
|
|
||||||
function createKeyUpEvent(key: number) {
|
function createKeyUpEvent(key: string) {
|
||||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||||
const event = {
|
const event = {
|
||||||
keyCode: key, preventDefault: () => {
|
key: key, preventDefault: () => {
|
||||||
}, stopPropagation: () => {
|
}, stopPropagation: () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -256,8 +256,8 @@ describe('DsDynamicTagComponent test suite', () => {
|
|||||||
expect(tagComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
|
expect(tagComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should add an item on ENTER or key press is \',\' or \';\'', fakeAsync(() => {
|
it('should add an item on ENTER or key press is \',\'', fakeAsync(() => {
|
||||||
let event = createKeyUpEvent(13);
|
let event = createKeyUpEvent('Enter');
|
||||||
tagComp.currentValue = 'test value';
|
tagComp.currentValue = 'test value';
|
||||||
|
|
||||||
tagFixture.detectChanges();
|
tagFixture.detectChanges();
|
||||||
@@ -268,7 +268,7 @@ describe('DsDynamicTagComponent test suite', () => {
|
|||||||
expect(tagComp.model.value).toEqual(['test value']);
|
expect(tagComp.model.value).toEqual(['test value']);
|
||||||
expect(tagComp.currentValue).toBeNull();
|
expect(tagComp.currentValue).toBeNull();
|
||||||
|
|
||||||
event = createKeyUpEvent(188);
|
event = createKeyUpEvent(',');
|
||||||
tagComp.currentValue = 'test value';
|
tagComp.currentValue = 'test value';
|
||||||
|
|
||||||
tagFixture.detectChanges();
|
tagFixture.detectChanges();
|
||||||
|
Reference in New Issue
Block a user