From 2198063f21955c7605babdd69fdc4bfb07b2623d Mon Sep 17 00:00:00 2001 From: ymurashka Date: Thu, 1 Feb 2024 21:42:11 +0300 Subject: [PATCH 1/4] test(esl-event-listener): fix swipe tests --- .../test/targets/swipe.test.ts | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) 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 () => { From f61fe536273c5c7a31f2327220502c82f44cc82d Mon Sep 17 00:00:00 2001 From: nsmirnova Date: Thu, 15 Feb 2024 00:35:24 +0100 Subject: [PATCH 2/4] refactor(lint): add commit lint scope validation --- .commitlintrc.yml | 11 ++++----- docs/COMMIT_CONVENTION.md | 47 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/.commitlintrc.yml b/.commitlintrc.yml index 037c7e6c7..b3c9af577 100644 --- a/.commitlintrc.yml +++ b/.commitlintrc.yml @@ -1,8 +1,9 @@ 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', 'lint' ] ] diff --git a/docs/COMMIT_CONVENTION.md b/docs/COMMIT_CONVENTION.md index 4f03580bb..c4a781209 100644 --- a/docs/COMMIT_CONVENTION.md +++ b/docs/COMMIT_CONVENTION.md @@ -163,3 +163,50 @@ Update of css rules order. Close PR #123. ``` + +### \ + +Scope is an optional part of your commit message. + +Utilize a scope to clarify the area of changes. + +Scope should be enclosed in parentheses after the type but before :. + +Scope should be in lowercase. +```text +fix(esl-utils): Fixed IE compatibility for scroll type detection +``` + +**Permissible Scope Values** + +To ensure consistency and clarity in commit messages, the following are the permissible scope values: + +- 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 +- lint From 406ac12c4cf7aed81d8f9b5e0c7c3c9c33c684b2 Mon Sep 17 00:00:00 2001 From: nsmirnova Date: Wed, 21 Feb 2024 09:19:38 +0100 Subject: [PATCH 3/4] refactor(lint): add commit lint scope validation --- .commitlintrc.yml | 65 +++++++++++++++++++++++++++++++++++---- docs/COMMIT_CONVENTION.md | 63 ++++++++----------------------------- 2 files changed, 71 insertions(+), 57 deletions(-) diff --git a/.commitlintrc.yml b/.commitlintrc.yml index b3c9af577..1d3efadb6 100644 --- a/.commitlintrc.yml +++ b/.commitlintrc.yml @@ -1,9 +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' ] ] - 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', 'lint' ] ] + 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 c4a781209..da1a92828 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. +Scope should be enclosed in parentheses after the type but before `:`. + +Scope should be in lowercase. ```text -fix(esl-component): IE compatibility +fix(esl-utils): Fixed IE compatibility for scroll type detection ``` +**Permissible 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). + --- ### \ @@ -164,49 +171,3 @@ Update of css rules order. Close PR #123. ``` -### \ - -Scope is an optional part of your commit message. - -Utilize a scope to clarify the area of changes. - -Scope should be enclosed in parentheses after the type but before :. - -Scope should be in lowercase. -```text -fix(esl-utils): Fixed IE compatibility for scroll type detection -``` - -**Permissible Scope Values** - -To ensure consistency and clarity in commit messages, the following are the permissible scope values: - -- 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 -- lint From 85a8cedae28f205cebddf9fafa5c37d7247c7528 Mon Sep 17 00:00:00 2001 From: "ala'n (Alexey Stsefanovich)" Date: Thu, 22 Feb 2024 16:08:52 +0100 Subject: [PATCH 4/4] docs: apply suggestions fore COMMIT_CONVENTION doc Co-authored-by: Anna Barmina <52083788+abarmina@users.noreply.github.com> --- docs/COMMIT_CONVENTION.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/COMMIT_CONVENTION.md b/docs/COMMIT_CONVENTION.md index da1a92828..5ac07699e 100644 --- a/docs/COMMIT_CONVENTION.md +++ b/docs/COMMIT_CONVENTION.md @@ -103,15 +103,15 @@ Using a scope enhances clarity and organization in commit messages, allowing for Utilize a scope to clarify the area of changes (module, component, feature, or epic). -Scope should be enclosed in parentheses after the type but before `:`. +The scope should be enclosed in parentheses after the type but before `:`. -Scope should be in lowercase. +The scope should be in lowercase. ```text -fix(esl-utils): Fixed IE compatibility for scroll type detection +fix(esl-utils): fix IE compatibility for scroll type detection ``` -**Permissible Scope Values** +**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).