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
22 changes: 11 additions & 11 deletions demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
"start": "ng serve"
},
"dependencies": {
"@angular/cdk": "21.0.0-rc.1",
"@angular/common": "21.0.0-rc.2",
"@angular/compiler": "21.0.0-rc.2",
"@angular/core": "21.0.0-rc.2",
"@angular/forms": "21.0.0-rc.2",
"@angular/material": "21.0.0-rc.1",
"@angular/platform-browser": "21.0.0-rc.2",
"@angular/router": "21.0.0-rc.2",
"@angular/cdk": "^21.0.1",
"@angular/common": "^21.0.1",
"@angular/compiler": "^21.0.1",
"@angular/core": "^21.0.1",
"@angular/forms": "^21.0.1",
"@angular/material": "^21.0.0",
"@angular/platform-browser": "^21.0.1",
"@angular/router": "^21.0.1",
"angular-ecmascript-intl": "../dist/angular-ecmascript-intl",
"marked": "^17.0.0",
"ngx-markdown": "^20.0.0",
"prismjs": "^1.30.0",
"tslib": "^2.8.1"
},
"devDependencies": {
"@angular/build": "21.0.0-rc.2",
"@angular/cli": "21.0.0-rc.2",
"@angular/compiler-cli": "21.0.0-rc.2",
"@angular/build": "^21.0.1",
"@angular/cli": "^21.0.1",
"@angular/compiler-cli": "^21.0.1",
"typescript": "~5.9.0"
}
}
3 changes: 1 addition & 2 deletions demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"importHelpers": true,
"target": "ES2022",
"module": "ES2022",
"useDefineForClassFields": false,
"lib": ["ES2022", "dom"]
"useDefineForClassFields": false
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
Expand Down
2 changes: 0 additions & 2 deletions libs/angular-ecmascript-intl/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
"test": {
"builder": "@angular/build:unit-test",
"options": {
"buildTarget": "::development",
"runner": "vitest",
"providersFile": "src/providers.ts",
"tsConfig": "tsconfig.spec.json",
"coverage": true,
"browsers": ["chromiumHeadless"]
}
Expand Down
18 changes: 9 additions & 9 deletions libs/angular-ecmascript-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@
"test": "ng test"
},
"devDependencies": {
"@angular/build": "21.0.0-rc.3",
"@angular/cli": "21.0.0-rc.3",
"@angular/common": "21.0.0-rc.2",
"@angular/core": "21.0.0-rc.2",
"@angular/platform-browser": "21.0.0-rc.2",
"@vitest/browser-playwright": "^4.0.0",
"@vitest/coverage-v8": "^4.0.0",
"@angular/build": "^21.0.1",
"@angular/cli": "^21.0.1",
"@angular/common": "^21.0.1",
"@angular/core": "^21.0.1",
"@angular/platform-browser": "^21.0.1",
"@vitest/browser-playwright": "4.0.8",
"@vitest/coverage-v8": "4.0.8",
"cpy-cli": "^6.0.0",
"dayjs": "^1.11.13",
"ng-packagr": "21.0.0-rc.1",
"ng-packagr": "^21.0.0",
"playwright": "^1.56.1",
"vitest": "^4.0.0"
"vitest": "4.0.8"
},
"sideEffects": false,
"author": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { IntlCountryPipe } from './intl-country.pipe';
describe('IntlCountryPipe', () => {
let testUnit: IntlCountryPipe;

beforeEach(() => TestBed.resetTestingModule());

describe('parsing', () => {
beforeEach(() => {
TestBed.runInInjectionContext(() => {
Expand Down Expand Up @@ -54,14 +56,7 @@ describe('IntlCountryPipe', () => {

describe('internationalization', () => {
it('should respect the set locale', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'de-DE',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'de-DE' });
TestBed.runInInjectionContext(() => (testUnit = new IntlCountryPipe()));

expect(testUnit.transform('AT')).toEqual('Österreich');
Expand All @@ -70,19 +65,9 @@ describe('IntlCountryPipe', () => {

describe('options', () => {
it('should not override the type option', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'de-DE',
},
{
provide: INTL_COUNTRY_PIPE_DEFAULT_OPTIONS,
useValue: {
type: 'language',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'de-DE' });
TestBed.overrideProvider(INTL_COUNTRY_PIPE_DEFAULT_OPTIONS, {
useValue: { type: 'language' },
});
TestBed.runInInjectionContext(() => (testUnit = new IntlCountryPipe()));

Expand All @@ -93,14 +78,7 @@ describe('IntlCountryPipe', () => {
});

it('should respect locale option', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.runInInjectionContext(() => (testUnit = new IntlCountryPipe()));

expect(testUnit.transform('US', { locale: 'de-DE' })).toEqual(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { IntlCurrencyPipe } from './intl-currency.pipe';
describe('IntlCurrencyPipe', () => {
let testUnit: IntlCurrencyPipe;

beforeEach(() => TestBed.resetTestingModule());

describe('parsing', () => {
beforeEach(() => {
TestBed.runInInjectionContext(() => {
Expand Down Expand Up @@ -58,14 +60,7 @@ describe('IntlCurrencyPipe', () => {

describe('internationalization', () => {
it('should respect the set locale', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'de-DE',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'de-DE' });
TestBed.runInInjectionContext(() => (testUnit = new IntlCurrencyPipe()));

expect(testUnit.transform(1024.2249, 'EUR')).toEqual('1.024,22\xa0€');
Expand All @@ -74,39 +69,23 @@ describe('IntlCurrencyPipe', () => {

describe('options', () => {
it('should respect the setting from default config', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
{
provide: INTL_CURRENCY_PIPE_DEFAULT_OPTIONS,
useValue: {
signDisplay: 'always',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.overrideProvider(INTL_CURRENCY_PIPE_DEFAULT_OPTIONS, {
useValue: {
signDisplay: 'always',
},
});
TestBed.runInInjectionContext(() => (testUnit = new IntlCurrencyPipe()));

expect(testUnit.transform(1, 'USD')).toEqual('+$1.00');
});

it('should give the user options a higher priority', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
{
provide: INTL_CURRENCY_PIPE_DEFAULT_OPTIONS,
useValue: {
signDisplay: 'exceptZero',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.overrideProvider(INTL_CURRENCY_PIPE_DEFAULT_OPTIONS, {
useValue: {
signDisplay: 'exceptZero',
},
});
TestBed.runInInjectionContext(() => (testUnit = new IntlCurrencyPipe()));

Expand All @@ -117,14 +96,7 @@ describe('IntlCurrencyPipe', () => {
});

it('should respect locale option', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.runInInjectionContext(() => (testUnit = new IntlCurrencyPipe()));

expect(testUnit.transform(1024, 'USD', { locale: 'de-DE' })).toEqual(
Expand All @@ -133,19 +105,11 @@ describe('IntlCurrencyPipe', () => {
});

it('should not override the style option', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
{
provide: INTL_CURRENCY_PIPE_DEFAULT_OPTIONS,
useValue: {
style: 'percent',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.overrideProvider(INTL_CURRENCY_PIPE_DEFAULT_OPTIONS, {
useValue: {
style: 'percent',
},
});
TestBed.runInInjectionContext(() => (testUnit = new IntlCurrencyPipe()));

Expand Down
57 changes: 15 additions & 42 deletions libs/angular-ecmascript-intl/src/lib/date/intl-date.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { IntlDatePipe } from './intl-date.pipe';
describe('DatePipe', () => {
let testUnit: IntlDatePipe;

beforeEach(() => TestBed.resetTestingModule());

describe('date parsing', () => {
beforeEach(() => {
TestBed.runInInjectionContext(() => {
Expand Down Expand Up @@ -74,14 +76,7 @@ describe('DatePipe', () => {

describe('internationalization', () => {
it('should respect the set locale', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'de-DE',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'de-DE' });
TestBed.runInInjectionContext(() => (testUnit = new IntlDatePipe()));

expect(testUnit.transform('2023-02-19')).toEqual('19.2.2023');
Expand All @@ -90,39 +85,23 @@ describe('DatePipe', () => {

describe('options', () => {
it('should respect the setting from default config', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
{
provide: INTL_DATE_PIPE_DEFAULT_OPTIONS,
useValue: {
dateStyle: 'medium',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.overrideProvider(INTL_DATE_PIPE_DEFAULT_OPTIONS, {
useValue: {
dateStyle: 'medium',
},
});
TestBed.runInInjectionContext(() => (testUnit = new IntlDatePipe()));

expect(testUnit.transform('2023-02-19')).toEqual('Feb 19, 2023');
});

it('should give the user options a higher priority', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
{
provide: INTL_DATE_PIPE_DEFAULT_OPTIONS,
useValue: {
dateStyle: 'full',
},
},
],
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });
TestBed.overrideProvider(INTL_DATE_PIPE_DEFAULT_OPTIONS, {
useValue: {
dateStyle: 'full',
},
});
TestBed.runInInjectionContext(() => (testUnit = new IntlDatePipe()));

Expand All @@ -133,14 +112,8 @@ describe('DatePipe', () => {
});

it('should respect locale option', () => {
TestBed.configureTestingModule({
providers: [
{
provide: INTL_LOCALES,
useValue: 'en-US',
},
],
});
TestBed.overrideProvider(INTL_LOCALES, { useValue: 'en-US' });

TestBed.runInInjectionContext(() => (testUnit = new IntlDatePipe()));

expect(testUnit.transform('2023-02-19', { locale: 'de-DE' })).toEqual(
Expand Down
Loading