Skip to content

Commit

Permalink
fix(cdk): rename TUI_IDENTITY_MATCHER to `TUI_DEFAULT_IDENTITY_MATC…
Browse files Browse the repository at this point in the history
…HER` to align to other constants (#38)
  • Loading branch information
waterplea authored Nov 18, 2020
1 parent b415d0b commit 3a9f2db
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion projects/cdk/constants/matcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const TUI_STRICT_MATCHER: TuiMatcher<any> = (
* @param item1 first element
* @param item2 second element
*/
export const TUI_IDENTITY_MATCHER: TuiIdentityMatcher<unknown> = (item1, item2) =>
export const TUI_DEFAULT_IDENTITY_MATCHER: TuiIdentityMatcher<unknown> = (item1, item2) =>
item1 === item2 || bothEmpty(item1, item2);

function bothEmpty(item1: unknown, item2: unknown): boolean {
Expand Down
10 changes: 7 additions & 3 deletions projects/cdk/constants/test/matcher.spec.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 => item.price.toString();
const search = 'HOLY GRAIL';
const item = new Item('Monty Python and the Holy Grail DVD', 99);
Expand Down Expand Up @@ -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);
});
Expand Down

0 comments on commit 3a9f2db

Please sign in to comment.