Skip to content

Commit 98fc76d

Browse files
committed
Create dynamic tag test events with key chars, not keyCodes
1 parent f313b4a commit 98fc76d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ import { FormFieldMetadataValueObject } from '../../../models/form-field-metadat
4545
import { DsDynamicTagComponent } from './dynamic-tag.component';
4646
import { DynamicTagModel } from './dynamic-tag.model';
4747

48-
function createKeyUpEvent(key: number) {
48+
function createKeyUpEvent(key: string) {
4949
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
5050
const event = {
51-
keyCode: key, preventDefault: () => {
51+
key: key, preventDefault: () => {
5252
}, stopPropagation: () => {
5353
},
5454
};
@@ -278,8 +278,8 @@ describe('DsDynamicTagComponent test suite', () => {
278278
expect(tagComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
279279
});
280280

281-
it('should add an item on ENTER or key press is \',\' or \';\'', fakeAsync(() => {
282-
let event = createKeyUpEvent(13);
281+
it('should add an item on ENTER or key press is \',\'', fakeAsync(() => {
282+
let event = createKeyUpEvent('Enter');
283283
tagComp.currentValue = 'test value';
284284

285285
tagFixture.detectChanges();
@@ -290,7 +290,7 @@ describe('DsDynamicTagComponent test suite', () => {
290290
expect(tagComp.model.value).toEqual(['test value']);
291291
expect(tagComp.currentValue).toBeNull();
292292

293-
event = createKeyUpEvent(188);
293+
event = createKeyUpEvent(',');
294294
tagComp.currentValue = 'test value';
295295

296296
tagFixture.detectChanges();

0 commit comments

Comments
 (0)