Skip to content

Commit 86a18f3

Browse files
kshepherdgithub-actions[bot]
authored andcommitted
Create dynamic tag test events with key chars, not keyCodes
(cherry picked from commit 98fc76d)
1 parent 1ade043 commit 86a18f3

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
@@ -22,10 +22,10 @@ import {
2222
mockDynamicFormValidationService
2323
} from '../../../../../testing/dynamic-form-mock-services';
2424

25-
function createKeyUpEvent(key: number) {
25+
function createKeyUpEvent(key: string) {
2626
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
2727
const event = {
28-
keyCode: key, preventDefault: () => {
28+
key: key, preventDefault: () => {
2929
}, stopPropagation: () => {
3030
}
3131
};
@@ -256,8 +256,8 @@ describe('DsDynamicTagComponent test suite', () => {
256256
expect(tagComp.chips.getChipsItems()).toEqual(chips.getChipsItems());
257257
});
258258

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

263263
tagFixture.detectChanges();
@@ -268,7 +268,7 @@ describe('DsDynamicTagComponent test suite', () => {
268268
expect(tagComp.model.value).toEqual(['test value']);
269269
expect(tagComp.currentValue).toBeNull();
270270

271-
event = createKeyUpEvent(188);
271+
event = createKeyUpEvent(',');
272272
tagComp.currentValue = 'test value';
273273

274274
tagFixture.detectChanges();

0 commit comments

Comments
 (0)