Skip to content

Commit 6174cdd

Browse files
committed
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
1 parent f249d88 commit 6174cdd

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

angular.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
"cli": {
162162
"schematicCollections": [
163163
"@angular-eslint/schematics"
164-
]
164+
],
165+
"analytics": false
165166
}
166167
}

projects/ngx-ui-loader/src/lib/core/ngx-ui-loader.component.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe('NgxUiLoaderComponent', () => {
233233
expect(fgSpinnerEl.style.color).toBe('blue');
234234
expect(fgSpinnerEl.style.width).toBe('70px');
235235
expect(fgSpinnerEl.style.height).toBe('70px');
236-
expect(fgSpinnerEl.style.top).toBe('calc((50% - 12px) - 15px)'); // gap
236+
expect(fgSpinnerEl.style.top).toBe('calc(50% - 27px)'); // gap
237237
expect(fgContainerEl.style.borderRadius).toBe('120px');
238238
expect(fgContainerEl.style.backgroundColor).toBe('white');
239239
expect(progressBarEl.style.color).toBe('teal');
@@ -264,9 +264,9 @@ describe('NgxUiLoaderComponent', () => {
264264
});
265265
fixture.detectChanges();
266266
logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo');
267-
expect(logoEl.style.top).toBe('calc(((50% - 30px) - 12px) - 24px)');
268-
expect(fgSpinnerEl.style.top).toBe('calc((50% + 60px) - 12px)');
269-
expect(textEl.style.top).toBe('calc(50% + 60px + 24px + 30px)');
267+
expect(logoEl.style.top).toBe('calc(50% - 66px)');
268+
expect(fgSpinnerEl.style.top).toBe('calc(50% + 48px)');
269+
expect(textEl.style.top).toBe('calc(50% + 114px)');
270270
});
271271

272272
it('#determinePosition - spinner and logo are center-center', () => {
@@ -284,8 +284,8 @@ describe('NgxUiLoaderComponent', () => {
284284
});
285285
fixture.detectChanges();
286286
logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo');
287-
expect(logoEl.style.top).toBe('calc((50% - 30px) - 12px)');
288-
expect(fgSpinnerEl.style.top).toBe('calc(50% + 60px + 12px)');
287+
expect(logoEl.style.top).toBe('calc(50% - 42px)');
288+
expect(fgSpinnerEl.style.top).toBe('calc(50% + 72px)');
289289
expect(textEl.style.top).toBe('30px');
290290
});
291291

@@ -305,8 +305,8 @@ describe('NgxUiLoaderComponent', () => {
305305
fixture.detectChanges();
306306
logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo');
307307
expect(logoEl.style.top).toBe('30px');
308-
expect(fgSpinnerEl.style.top).toBe('calc((50% - 12px) - 12px)');
309-
expect(textEl.style.top).toBe('calc(50% + 30px + 12px)');
308+
expect(fgSpinnerEl.style.top).toBe('calc(50% - 24px)');
309+
expect(textEl.style.top).toBe('calc(50% + 42px)');
310310
});
311311

312312
it('#determinePosition - logo and text are center-center', () => {
@@ -324,9 +324,9 @@ describe('NgxUiLoaderComponent', () => {
324324
});
325325
fixture.detectChanges();
326326
logoEl = ngxUiLoaderEl.querySelector('.ngx-loading-logo');
327-
expect(logoEl.style.top).toBe('calc((50% - 12px) - 12px)');
327+
expect(logoEl.style.top).toBe('calc(50% - 24px)');
328328
expect(fgSpinnerEl.style.top).toBe('30px');
329-
expect(textEl.style.top).toBe('calc(50% + 60px + 12px)');
329+
expect(textEl.style.top).toBe('calc(50% + 72px)');
330330
});
331331

332332
it('#determinePosition - logo, spinner and text are bottom-center', () => {

0 commit comments

Comments
 (0)