Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/deploy-apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI Deploy

on:
push:
branches: [ "main" ]
branches: ['main']
paths:
- 'apps/**'
- 'libs/**'
Expand All @@ -20,7 +20,7 @@ permissions:
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: false

jobs:
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
cp -r dist/tooltip-demo/* deploy/tooltip-demo/
mkdir deploy/virtual-table-demo
cp -r dist/virtual-table-demo/* deploy/virtual-table-demo/

# Create a 404.html to handle SPA routing redirects
cp deploy/index.html deploy/404.html

Expand Down
9 changes: 6 additions & 3 deletions libs/cdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ All notable changes to this project will be documented in this file. See

### Bug Fixes

* **cdk:** virtual table now correctly rerenders after setting sort types manually multiple times ([c5f715c](https://github.com/Angular-RU/angular-ru-sdk/commit/c5f715c3098aa53f18d66da72b49bacdd190524a))
- **cdk:** virtual table now correctly rerenders after setting sort types manually multiple times
([c5f715c](https://github.com/Angular-RU/angular-ru-sdk/commit/c5f715c3098aa53f18d66da72b49bacdd190524a))

### Features

* angular v20 and NX v21 ([1aa382d](https://github.com/Angular-RU/angular-ru-sdk/commit/1aa382d505962c260c6f8a871bdb7d58d2b8b1cb))
* standalone components and pipes; root providers instead of forRoot(); removal of ngModules ([729959c](https://github.com/Angular-RU/angular-ru-sdk/commit/729959c201623ffc4406d680d46908059d9a5754))
- angular v20 and NX v21
([1aa382d](https://github.com/Angular-RU/angular-ru-sdk/commit/1aa382d505962c260c6f8a871bdb7d58d2b8b1cb))
- standalone components and pipes; root providers instead of forRoot(); removal of ngModules
([729959c](https://github.com/Angular-RU/angular-ru-sdk/commit/729959c201623ffc4406d680d46908059d9a5754))

# [15.2.0](https://github.com/Angular-RU/angular-ru-sdk/compare/@angular-ru/[email protected]...@angular-ru/[email protected]) (2024-04-10)

Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/array/include.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ describe('[TEST]: include', () => {
expect([1, 2, 3].filter(include(4))).toEqual([]);
expect([1, 2, 3].filter(include([2, 3, 4]))).toEqual([2, 3]);
expect([{v: 1}, {v: 2}, {v: 3}].filter(include({v: 1}))).toEqual([]);

const unique: PlainObject = {v: 1};

expect([unique, {v: 2}, {v: 3}].filter(include([unique]))).toEqual([unique]);
Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/array/unique-array-of.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable sonarjs/no-hardcoded-ip */
import {uniqueArrayOf} from '@angular-ru/cdk/array';

describe('[TEST]: unique array of', () => {
Expand Down
9 changes: 9 additions & 0 deletions libs/cdk/tests/array/unique.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,56 +10,65 @@ describe('[TEST]: unique', () => {
[],
);
});

it('should return one object', () => {
expect(
[a].filter((element, index, self) => unique(element, index, self)),
).toEqual([a]);
});

it('should return the same array', () => {
expect(
[a, b, c].filter((element, index, self) => unique(element, index, self)),
).toEqual([a, b, c]);
});

it('should return array with no duplicates of objects', () => {
expect(
[a, b, c, c, a].filter((element, index, self) =>
unique(element, index, self),
),
).toEqual([a, b, c]);
});

it('should return array with no duplicates of strings', () => {
expect(
['a', 'b', 'b', 'b'].filter((element, index, self) =>
unique(element, index, self),
),
).toEqual(['a', 'b']);
});

it('should return array with no duplicates of numbers', () => {
expect(
[13, 13, 13].filter((element, index, self) => unique(element, index, self)),
).toEqual([13]);
});

it('should return array with no duplicates according to values and types', () => {
expect(
[a, a, 'a', 13, 13, '13'].filter((element, index, self) =>
unique(element, index, self),
),
).toEqual([a, 'a', 13, '13']);
});

it('should return array with no duplicates of booleans', () => {
expect(
[true, true, false].filter((element, index, self) =>
unique(element, index, self),
),
).toEqual([true, false]);
});

it('should return array with no duplicates of "no value" types', () => {
expect(
[null, null, undefined, undefined, '', '', Infinity, Infinity].filter(
(element, index, self) => unique(element, index, self),
),
).toEqual([null, undefined, '', Infinity]);
});

it('should return empty array for the array of "NaN"', () => {
expect(
[NaN, NaN].filter((element, index, self) => unique(element, index, self)),
Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/array/utility-arrays.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable sonarjs/no-undefined-argument */
import {
exclude,
hasAtMostOneItem,
Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/big-decimal/add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ describe('[TEST]: BigDecimal - add', () => {
it('should: 126.7-13 = 113.7', () => {
expect(BigDecimal.add('126.7', '-13')).toBe('113.7');
});

it('should: 12.67-130.7 = -118.03', () => {
expect(BigDecimal.add('12.67', '-130.7')).toBe('-118.03');
});
Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/big-decimal/big-decimal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ describe('[TEST]: BigDecimal - main', () => {
'0',
);
});

it('should: -0.0000005 * 13 = -0.0000065', () => {
expect(
new BigDecimal('-0.0000005').multiply(new BigDecimal('13')).getValue(),
Expand Down
5 changes: 5 additions & 0 deletions libs/cdk/tests/big-decimal/compare-to.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ describe('[TEST]: BigDecimal - compareTo', () => {
it('should: 126.7, -13 = 1', () => {
expect(BigDecimal.compareTo('126.7', '-13')).toBe(1);
});

it('should: 12.67, -12.67 = 1', () => {
expect(BigDecimal.compareTo('12.67', '-12.67')).toBe(1);
});

it('should: 12.67, 12.67 = 0', () => {
expect(BigDecimal.compareTo('12.67', '12.67')).toBe(0);
});

it('should: 12.67, 12.6700 = 0', () => {
expect(BigDecimal.compareTo('12.67', '12.6700')).toBe(0);
});

it('should: -12.67, -12.6700 = 0', () => {
expect(BigDecimal.compareTo('-12.67', '-12.6700')).toBe(0);
});

it('should: 0.67, .6700 = 0', () => {
expect(BigDecimal.compareTo('0.67', '.6700')).toBe(0);
});
Expand Down
1 change: 1 addition & 0 deletions libs/cdk/tests/big-decimal/multiply.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('[TEST]: BigDecimal - multiply', () => {
it('should: -12 * -0 = 0', () => {
expect(BigDecimal.multiply('-12', '-0')).toBe('0');
});

it('should: -0.0000005 * 13 = -0.0000065', () => {
expect(BigDecimal.multiply('-0.0000005', '13')).toBe('-0.0000065');
});
Expand Down
2 changes: 2 additions & 0 deletions libs/cdk/tests/class-transformer/class-transformer.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ describe('[TEST]: Integration with class-transformer', () => {
const actual: DemoDto = new DemoDto();

actual.numVal = 'INVALID NUMBER';

expect(actual.numVal).toBe('INVALID NUMBER');
expect(plainToClass(DemoDto, actual).numVal).toBeNaN();
});
Expand All @@ -137,6 +138,7 @@ describe('[TEST]: Integration with class-transformer', () => {
const actual: DemoDto = new DemoDto();

actual.numVal = ' 100 ';

expect(actual.numVal).toBe(' 100 ');
expect(plainToClass(DemoDto, actual).numVal).toBe(100);
});
Expand Down
50 changes: 21 additions & 29 deletions libs/cdk/tests/class-transformer/transform-to-boolean.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,28 @@ import {transformToBoolean} from '@angular-ru/cdk/class-transformer';
import {TransformFnParams} from 'class-transformer';

describe('[TEST] TransformToBoolean', () => {
it('should return true', () => {
const data: TransformFnParams[] = [
{value: true} as TransformFnParams,
{value: 'true'} as TransformFnParams,
{value: '12312s'} as TransformFnParams,
{value: '0'} as TransformFnParams,
{value: '1'} as TransformFnParams,
{value: {}} as TransformFnParams,
{value: []} as TransformFnParams,
{value: ''} as TransformFnParams,
{value: ' '} as TransformFnParams,
];

for (const item of data) {
expect(transformToBoolean(item)).toBe(true);
}
it.each<TransformFnParams>([
{value: true} as TransformFnParams,
{value: 'true'} as TransformFnParams,
{value: '12312s'} as TransformFnParams,
{value: '0'} as TransformFnParams,
{value: '1'} as TransformFnParams,
{value: {}} as TransformFnParams,
{value: []} as TransformFnParams,
{value: ''} as TransformFnParams,
{value: ' '} as TransformFnParams,
])('should return true', (item: TransformFnParams) => {
expect(transformToBoolean(item)).toBe(true);
});

it('should return false', () => {
const data: TransformFnParams[] = [
{value: ' false '} as TransformFnParams,
{value: 'false'} as TransformFnParams,
{value: false} as TransformFnParams,
{value: 0} as TransformFnParams,
{value: null} as TransformFnParams,
{value: undefined} as TransformFnParams,
];

for (const item of data) {
expect(transformToBoolean(item)).toBe(false);
}
it.each<TransformFnParams>([
{value: ' false '} as TransformFnParams,
{value: 'false'} as TransformFnParams,
{value: false} as TransformFnParams,
{value: 0} as TransformFnParams,
{value: null} as TransformFnParams,
{value: undefined} as TransformFnParams,
])('should return false', (item: TransformFnParams) => {
expect(transformToBoolean(item)).toBe(false);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,33 @@ import {transformToNullableBoolean} from '@angular-ru/cdk/class-transformer';
import {TransformFnParams} from 'class-transformer';

describe('[TEST] TransformToNullableBoolean', () => {
it('should return true', () => {
const data: TransformFnParams[] = [
{value: true} as TransformFnParams,
{value: 'true'} as TransformFnParams,
{value: '12312s'} as TransformFnParams,
{value: '0'} as TransformFnParams,
{value: '1'} as TransformFnParams,
{value: {}} as TransformFnParams,
{value: []} as TransformFnParams,
{value: ''} as TransformFnParams,
{value: ' '} as TransformFnParams,
];

for (const item of data) {
expect(transformToNullableBoolean(item)).toBe(true);
}
it.each<TransformFnParams>([
{value: true} as TransformFnParams,
{value: 'true'} as TransformFnParams,
{value: '12312s'} as TransformFnParams,
{value: '0'} as TransformFnParams,
{value: '1'} as TransformFnParams,
{value: {}} as TransformFnParams,
{value: []} as TransformFnParams,
{value: ''} as TransformFnParams,
{value: ' '} as TransformFnParams,
])('should return true', (item: TransformFnParams) => {
expect(transformToNullableBoolean(item)).toBe(true);
});

it('should return false', () => {
const data: TransformFnParams[] = [
{value: ' false '} as TransformFnParams,
{value: 'false'} as TransformFnParams,
{value: false} as TransformFnParams,
{value: 0} as TransformFnParams,
];

for (const item of data) {
expect(transformToNullableBoolean(item)).toBe(false);
}
it.each<TransformFnParams>([
{value: ' false '} as TransformFnParams,
{value: 'false'} as TransformFnParams,
{value: false} as TransformFnParams,
{value: 0} as TransformFnParams,
])('should return false', (item: TransformFnParams) => {
expect(transformToNullableBoolean(item)).toBe(false);
});

it('should return null', () => {
const data: TransformFnParams[] = [
{value: null} as TransformFnParams,
{value: undefined} as TransformFnParams,
];

for (const item of data) {
expect(transformToNullableBoolean(item)).toBeNull();
}
it.each<TransformFnParams>([
{value: null} as TransformFnParams,
{value: undefined} as TransformFnParams,
])('should return null', (item: TransformFnParams) => {
expect(transformToNullableBoolean(item)).toBeNull();
});
});
35 changes: 20 additions & 15 deletions libs/cdk/tests/date/end-of-day.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,38 @@ describe('[TEST]: EndOfDay', (): void => {
const expectDate: Date = endOfDay(someDate);
const withoutTimezone: string = toISOStringWithoutTimezone(expectDate);

if (timezoneOffSet <= 0) {
expect(withoutTimezone).toBe('2021-03-29T23:59:59.999');
} else {
expect(withoutTimezone).toBe('2021-03-28T23:59:59.999');
}
const result =
timezoneOffSet <= 0
? '2021-03-29T23:59:59.999'
: '2021-03-28T23:59:59.999';

expect(withoutTimezone).toBe(result);
});

it('should correctly convert "2021-03-29T23:00:00.000Z"', (): void => {
const someDate: Date = new Date('2021-03-29T23:00:00.000Z');
const expectDate: Date = endOfDay(someDate);
const withoutTimezone: string = toISOStringWithoutTimezone(expectDate);

if (timezoneOffSet <= -60) {
expect(withoutTimezone).toBe('2021-03-30T23:59:59.999');
} else {
expect(withoutTimezone).toBe('2021-03-29T23:59:59.999');
}
const result =
timezoneOffSet <= -60
? '2021-03-30T23:59:59.999'
: '2021-03-29T23:59:59.999';

expect(withoutTimezone).toBe(result);
});

it('should correctly convert "2021-03-29T23:59:59.999Z"', (): void => {
const someDate: Date = new Date('2021-03-29T23:59:59.999Z');
const expectDate: Date = endOfDay(someDate);
const withoutTimezone: string = toISOStringWithoutTimezone(expectDate);

if (timezoneOffSet < 0) {
expect(withoutTimezone).toBe('2021-03-30T23:59:59.999');
} else {
expect(withoutTimezone).toBe('2021-03-29T23:59:59.999');
}
const result =
timezoneOffSet < 0
? '2021-03-30T23:59:59.999'
: '2021-03-29T23:59:59.999';

expect(withoutTimezone).toBe(result);
});
});
});
Loading
Loading