diff --git a/.commitlintrc.yml b/.commitlintrc.yml index 037c7e6c7..1d3efadb6 100644 --- a/.commitlintrc.yml +++ b/.commitlintrc.yml @@ -1,8 +1,62 @@ extends: - "@commitlint/config-conventional" rules: - header-max-length: [1, 'always', 120] - body-max-length: [1, 'always', 150] - body-max-line-length: [1, 'always', 150] - footer-max-line-length: [1, 'always', 120] - subject-case: [1, 'never', ['sentence-case', 'start-case', 'pascal-case', 'upper-case']] + header-max-length: + - 1 + - always + - 120 + body-max-length: + - 1 + - always + - 150 + body-max-line-length: + - 1 + - always + - 150 + footer-max-line-length: + - 1 + - always + - 120 + subject-case: + - 1 + - never + - + - sentence-case + - start-case + - pascal-case + - upper-case + scope-enum: + - 2 + - always + - + - esl-a11y-group + - esl-alert + - esl-animate + - esl-base-element + - esl-carousel + - esl-event-listener + - esl-footnotes + - esl-forms + - esl-image + - esl-media + - esl-media-query + - esl-mixin-element + - esl-open-state + - esl-panel + - esl-panel-group + - esl-popup + - esl-random-text + - esl-related-target + - esl-scrollbar + - esl-share + - esl-tab + - esl-toggleable + - esl-tooltip + - esl-traversing-query + - esl-trigger + - esl-utils + - site + - deps + - deps-dev + - lint + - e2e diff --git a/docs/COMMIT_CONVENTION.md b/docs/COMMIT_CONVENTION.md index 4f03580bb..5ac07699e 100644 --- a/docs/COMMIT_CONVENTION.md +++ b/docs/COMMIT_CONVENTION.md @@ -97,18 +97,25 @@ BREAKING CHANGES: ### \ -Scope is an optional but "nice to have" part of your commit message. +Scope is highly recommended part of your commit message. -Use a scope to clarify changes area (module, component, feature or epic). +Using a scope enhances clarity and organization in commit messages, allowing for better categorization of changes. -Scope should be placed in parentheses after type but before `:`. +Utilize a scope to clarify the area of changes (module, component, feature, or epic). -The scope should be compatibly short and in lowercase. +The scope should be enclosed in parentheses after the type but before `:`. + +The scope should be in lowercase. ```text -fix(esl-component): IE compatibility +fix(esl-utils): fix IE compatibility for scroll type detection ``` +**Valid Scope Values** + +To ensure consistency and clarity in commit messages, refer to +the [list of permissible scope values](https://github.com/exadel-inc/esl/blob/58095ed129ae6fcc0e1a2e32f099af36c090a176/.commitlintrc.yml). + --- ### \ @@ -163,3 +170,4 @@ Update of css rules order. Close PR #123. ``` + diff --git a/src/modules/esl-event-listener/test/targets/swipe.test.ts b/src/modules/esl-event-listener/test/targets/swipe.test.ts index c68dc49eb..7065091fa 100644 --- a/src/modules/esl-event-listener/test/targets/swipe.test.ts +++ b/src/modules/esl-event-listener/test/targets/swipe.test.ts @@ -10,22 +10,22 @@ describe('ESLSwipeGestureTarget EventTarget', () => { test('ESLResizeObserverTarget.for(undefined) returns null without error', () => { expect(ESLSwipeGestureTarget.for(undefined as any)).toBeNull(); - expect(consoleSpy).toBeCalled(); + expect(consoleSpy).toHaveBeenCalled(); }); test('ESLResizeObserverTarget.for(null) returns null without error', () => { expect(ESLSwipeGestureTarget.for(null as any)).toBeNull(); - expect(consoleSpy).toBeCalled(); + expect(consoleSpy).toHaveBeenCalled(); }); test('ESLResizeObserverTarget.for(123) returns null without error', () => { expect(ESLSwipeGestureTarget.for(123 as any)).toBeNull(); - expect(consoleSpy).toBeCalled(); + expect(consoleSpy).toHaveBeenCalled(); }); test('ESLResizeObserverTarget.for({}) returns null without error', () => { expect(ESLSwipeGestureTarget.for({} as any)).toBeNull(); - expect(consoleSpy).toBeCalled(); + expect(consoleSpy).toHaveBeenCalled(); }); }); @@ -38,24 +38,24 @@ describe('ESLSwipeGestureTarget EventTarget', () => { const listener2 = jest.fn(); test('ESLSwipeGestureTarget does not produce subscription on creation', () => { - expect(addEventListenerSpy).not.toBeCalled(); - expect(removeEventListenerSpy).not.toBeCalled(); + expect(addEventListenerSpy).not.toHaveBeenCalled(); + expect(removeEventListenerSpy).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget doesn`t unsubscribe old listeners upon adding new ones', () => { target.addEventListener('swipe', listener1); - expect(addEventListenerSpy).toBeCalled(); - expect(removeEventListenerSpy).not.toBeCalled(); + expect(addEventListenerSpy).toHaveBeenCalled(); + expect(removeEventListenerSpy).not.toHaveBeenCalled(); target.addEventListener('swipe', listener2); - expect(addEventListenerSpy).toBeCalled(); - expect(removeEventListenerSpy).not.toBeCalled(); + expect(addEventListenerSpy).toHaveBeenCalled(); + expect(removeEventListenerSpy).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget doesn`t unsubscrie until last subscription is removed from target', () => { target.removeEventListener('swipe', listener1); - expect(removeEventListenerSpy).not.toBeCalled(); + expect(removeEventListenerSpy).not.toHaveBeenCalled(); target.removeEventListener('swipe', listener2); - expect(removeEventListenerSpy).toBeCalled(); + expect(removeEventListenerSpy).toHaveBeenCalled(); }); }); @@ -70,7 +70,7 @@ describe('ESLSwipeGestureTarget EventTarget', () => { }; const $el = document.createElement('div'); - const target = ESLSwipeGestureTarget.for($el, {timeout: 50}); + const target = ESLSwipeGestureTarget.for($el, {timeout: 150}); const listener = jest.fn(); beforeAll(() => target.addEventListener('swipe', listener)); @@ -112,25 +112,25 @@ describe('ESLSwipeGestureTarget EventTarget', () => { test('ESLSwipeGestureTarget ignores short horizontal swipes', async () => { $el.dispatchEvent(createEvent(START_EVENT, {pageX: 100, pageY: 100})); window.dispatchEvent(createEvent(END_EVENT, {pageX: 110, pageY: 105, target: $el})); - expect(listener).not.toBeCalled(); + expect(listener).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget ignores short vertical swipes', async () => { $el.dispatchEvent(createEvent(START_EVENT, {pageX: 100, pageY: 100})); window.dispatchEvent(createEvent(END_EVENT, {pageX: 105, pageY: 110, target: $el})); - expect(listener).not.toBeCalled(); + expect(listener).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget ignores long - lasting swipe', async () => { $el.dispatchEvent(createEvent(START_EVENT, {pageX: 100, pageY: 100})); await promisifyTimeout(150); window.dispatchEvent(createEvent(END_EVENT, {pageX: 210, pageY: 105, target: $el})); - expect(listener).not.toBeCalled(); + expect(listener).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget ignores unlinked events', async () => { window.dispatchEvent(createEvent(END_EVENT, {pageX: 210, pageY: 105, target: $el})); - expect(listener).not.toBeCalled(); + expect(listener).not.toHaveBeenCalled(); }); test('ESLSwipeGestureTarget processes diagonal swipes', async () => {