From 6174cddcac6388e81ab16520dfa97d023256b0c9 Mon Sep 17 00:00:00 2001 From: t-ho Date: Mon, 28 Jul 2025 17:16:17 -0700 Subject: [PATCH 1/2] fix: Update position calculation test expectations - Fix failing position calculation tests to match current component implementation - Update test expectations from nested calc format to simplified format - Disable Angular CLI analytics in angular.json - All 133 tests now pass with 100% coverage --- angular.json | 3 ++- .../lib/core/ngx-ui-loader.component.spec.ts | 20 +++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/angular.json b/angular.json index ca6aa06..2bf88ba 100644 --- a/angular.json +++ b/angular.json @@ -161,6 +161,7 @@ "cli": { "schematicCollections": [ "@angular-eslint/schematics" - ] + ], + "analytics": false } } diff --git a/projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.component.spec.ts b/projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.component.spec.ts index 3b6cb11..40e9d9c 100644 --- a/projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.component.spec.ts +++ b/projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.component.spec.ts @@ -233,7 +233,7 @@ describe('NgxUiLoaderComponent', () => { expect(fgSpinnerEl.style.color).toBe('blue'); expect(fgSpinnerEl.style.width).toBe('70px'); expect(fgSpinnerEl.style.height).toBe('70px'); - expect(fgSpinnerEl.style.top).toBe('calc((50% - 12px) - 15px)'); // gap + expect(fgSpinnerEl.style.top).toBe('calc(50% - 27px)'); // gap expect(fgContainerEl.style.borderRadius).toBe('120px'); expect(fgContainerEl.style.backgroundColor).toBe('white'); expect(progressBarEl.style.color).toBe('teal'); @@ -264,9 +264,9 @@ describe('NgxUiLoaderComponent', () => { }); fixture.detectChanges(); logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo'); - expect(logoEl.style.top).toBe('calc(((50% - 30px) - 12px) - 24px)'); - expect(fgSpinnerEl.style.top).toBe('calc((50% + 60px) - 12px)'); - expect(textEl.style.top).toBe('calc(50% + 60px + 24px + 30px)'); + expect(logoEl.style.top).toBe('calc(50% - 66px)'); + expect(fgSpinnerEl.style.top).toBe('calc(50% + 48px)'); + expect(textEl.style.top).toBe('calc(50% + 114px)'); }); it('#determinePosition - spinner and logo are center-center', () => { @@ -284,8 +284,8 @@ describe('NgxUiLoaderComponent', () => { }); fixture.detectChanges(); logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo'); - expect(logoEl.style.top).toBe('calc((50% - 30px) - 12px)'); - expect(fgSpinnerEl.style.top).toBe('calc(50% + 60px + 12px)'); + expect(logoEl.style.top).toBe('calc(50% - 42px)'); + expect(fgSpinnerEl.style.top).toBe('calc(50% + 72px)'); expect(textEl.style.top).toBe('30px'); }); @@ -305,8 +305,8 @@ describe('NgxUiLoaderComponent', () => { fixture.detectChanges(); logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo'); expect(logoEl.style.top).toBe('30px'); - expect(fgSpinnerEl.style.top).toBe('calc((50% - 12px) - 12px)'); - expect(textEl.style.top).toBe('calc(50% + 30px + 12px)'); + expect(fgSpinnerEl.style.top).toBe('calc(50% - 24px)'); + expect(textEl.style.top).toBe('calc(50% + 42px)'); }); it('#determinePosition - logo and text are center-center', () => { @@ -324,9 +324,9 @@ describe('NgxUiLoaderComponent', () => { }); fixture.detectChanges(); logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo'); - expect(logoEl.style.top).toBe('calc((50% - 12px) - 12px)'); + expect(logoEl.style.top).toBe('calc(50% - 24px)'); expect(fgSpinnerEl.style.top).toBe('30px'); - expect(textEl.style.top).toBe('calc(50% + 60px + 12px)'); + expect(textEl.style.top).toBe('calc(50% + 72px)'); }); it('#determinePosition - logo, spinner and text are bottom-center', () => { From 8a31640c83002b6311e7698faa449ae020a68c43 Mon Sep 17 00:00:00 2001 From: t-ho Date: Mon, 28 Jul 2025 17:40:30 -0700 Subject: [PATCH 2/2] fix: Update GitHub workflow for Angular 14 compatibility - Update Actions to latest versions (checkout@v4, setup-node@v4, codecov@v4) - Update Node.js versions to 16.x, 18.x, 20.x (remove deprecated 14.x) - Add Chrome setup for headless testing - Use npm ci and built-in caching for better performance - Use npm run scripts instead of npx commands - Make codecov upload optional to prevent CI failures --- .github/workflows/test.yml | 48 ++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3ca5be0..2c17ca2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,33 +16,41 @@ jobs: strategy: matrix: - node-version: [14.x, 16.x] + node-version: [16.x, 18.x, 20.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - name: Cache Node.js modules - uses: actions/cache@v2 + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Setup Chrome + uses: browser-actions/setup-chrome@v1 with: - path: ~/.npm - key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node-${{ matrix.node-version }}- - ${{ runner.OS }}-node- - ${{ runner.OS }}- - - - name: Install deps - run: npm install + chrome-version: stable + - name: Linting - run: npx ng lint - - name: Build lib - run: npx ng build ngx-ui-loader + run: npm run lint + + - name: Build library + run: npm run build:lib + + - name: Build schematics + run: npm run build:schematics + - name: Testing - run: npm test + run: npm run test + - name: Upload codecov report - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 + with: + fail_ci_if_error: false + - name: Production build - run: npx ng build + run: npm run build \ No newline at end of file