From 268f3ef2396b136f054fee1e54e3d1c918570c99 Mon Sep 17 00:00:00 2001 From: waterplea Date: Wed, 18 Nov 2020 18:37:48 +0300 Subject: [PATCH] fix(cdk): rename `TUI_IDENTITY_MATCHER` to `TUI_DEFAULT_IDENTITY_MATCHER` to align to other constants --- CHANGELOG.md | 2 -- projects/cdk/constants/matcher.ts | 2 +- projects/cdk/constants/test/matcher.spec.ts | 10 +++++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5340d6326022..b3676c245d7c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,10 +15,8 @@ All notable changes to this project will be documented in this file. See [standa ### Features - **cdk:** `TUI_IDENTITY_MATCHER` consider two empty arrays equal ([#34](https://github.com/TinkoffCreditSystems/taiga-ui/issues/34)) ([e17c08d](https://github.com/TinkoffCreditSystems/taiga-ui/commit/e17c08d7eb209c6b389b4dc07a32ff9e792d70af)) -- **cdk:** `TUI_IDENTITY_MATCHER` consider two empty arrays equal ([#35](https://github.com/TinkoffCreditSystems/taiga-ui/issues/35)) ([0983a17](https://github.com/TinkoffCreditSystems/taiga-ui/commit/0983a176bd6f3eae2f03f26da2c2a709a083fa22)) - **cdk:** add @ng-web-apis/mutation-observer ([#32](https://github.com/TinkoffCreditSystems/taiga-ui/issues/32)) ([7459c70](https://github.com/TinkoffCreditSystems/taiga-ui/commit/7459c70f272b464cd95959a7f66f039194d874ce)) - **cdk:** remove preventScroll polyfill ([#21](https://github.com/TinkoffCreditSystems/taiga-ui/issues/21)) ([68db75a](https://github.com/TinkoffCreditSystems/taiga-ui/commit/68db75adc7bb3d7eea37709963e89a3ab2152f1e)) -- **observables:** `stopPropagation` add operator ([bed17a5](https://github.com/TinkoffCreditSystems/taiga-ui/commit/bed17a569adee2a6013109e0ca4db4d1b1651c0a)) - **observables:** `stopPropagation` add operator ([d930e9d](https://github.com/TinkoffCreditSystems/taiga-ui/commit/d930e9dcc0255c154089d1baceb4fe0a28e74604)) ### Bug Fixes diff --git a/projects/cdk/constants/matcher.ts b/projects/cdk/constants/matcher.ts index a586aca9640e..8ff933cb8e77 100644 --- a/projects/cdk/constants/matcher.ts +++ b/projects/cdk/constants/matcher.ts @@ -32,7 +32,7 @@ export const TUI_STRICT_MATCHER: TuiMatcher = ( * @param item1 first element * @param item2 second element */ -export const TUI_IDENTITY_MATCHER: TuiIdentityMatcher = (item1, item2) => +export const TUI_DEFAULT_IDENTITY_MATCHER: TuiIdentityMatcher = (item1, item2) => item1 === item2 || bothEmpty(item1, item2); function bothEmpty(item1: unknown, item2: unknown): boolean { diff --git a/projects/cdk/constants/test/matcher.spec.ts b/projects/cdk/constants/test/matcher.spec.ts index ec32f57c4687..f7d86ceb3f24 100644 --- a/projects/cdk/constants/test/matcher.spec.ts +++ b/projects/cdk/constants/test/matcher.spec.ts @@ -1,5 +1,9 @@ import {TuiStringHandler} from '../../types/handler'; -import {TUI_DEFAULT_MATCHER, TUI_IDENTITY_MATCHER, TUI_STRICT_MATCHER} from '../matcher'; +import { + TUI_DEFAULT_IDENTITY_MATCHER, + TUI_DEFAULT_MATCHER, + TUI_STRICT_MATCHER, +} from '../matcher'; import {TUI_DEFAULT_STRINGIFY} from '../stringify'; class Item { @@ -14,7 +18,7 @@ describe('Matcher functions', () => { const defaultStringify = TUI_DEFAULT_STRINGIFY; const defaultMatcher = TUI_DEFAULT_MATCHER; const strictMatcher = TUI_STRICT_MATCHER; - const identityMatcher = TUI_IDENTITY_MATCHER; + const identityMatcher = TUI_DEFAULT_IDENTITY_MATCHER; const stringify: TuiStringHandler = item => item.price.toString(); const search = 'HOLY GRAIL'; const item = new Item('Monty Python and the Holy Grail DVD', 99); @@ -66,7 +70,7 @@ describe('Matcher functions', () => { }); }); - describe('TUI_IDENTITY_MATCHER', () => { + describe('TUI_DEFAULT_IDENTITY_MATCHER', () => { it('returns true if the parameters are the same', () => { expect(identityMatcher(item, item)).toBe(true); });