Skip to content

Commit 4e7a2c2

Browse files
authored
Merge pull request #130 from t-ho/fix/position-calculation-tests
fix: Update position calculation test expectations
2 parents f249d88 + 8a31640 commit 4e7a2c2

File tree

3 files changed

+40
-31
lines changed

3 files changed

+40
-31
lines changed

.github/workflows/test.yml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,41 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
node-version: [14.x, 16.x]
19+
node-version: [16.x, 18.x, 20.x]
2020

2121
steps:
22-
- uses: actions/checkout@v2
22+
- uses: actions/checkout@v4
23+
2324
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v1
25+
uses: actions/setup-node@v4
2526
with:
2627
node-version: ${{ matrix.node-version }}
27-
- name: Cache Node.js modules
28-
uses: actions/cache@v2
28+
cache: 'npm'
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Setup Chrome
34+
uses: browser-actions/setup-chrome@v1
2935
with:
30-
path: ~/.npm
31-
key: ${{ runner.OS }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
32-
restore-keys: |
33-
${{ runner.OS }}-node-${{ matrix.node-version }}-
34-
${{ runner.OS }}-node-
35-
${{ runner.OS }}-
36-
37-
- name: Install deps
38-
run: npm install
36+
chrome-version: stable
37+
3938
- name: Linting
40-
run: npx ng lint
41-
- name: Build lib
42-
run: npx ng build ngx-ui-loader
39+
run: npm run lint
40+
41+
- name: Build library
42+
run: npm run build:lib
43+
44+
- name: Build schematics
45+
run: npm run build:schematics
46+
4347
- name: Testing
44-
run: npm test
48+
run: npm run test
49+
4550
- name: Upload codecov report
46-
uses: codecov/codecov-action@v1
51+
uses: codecov/codecov-action@v4
52+
with:
53+
fail_ci_if_error: false
54+
4755
- name: Production build
48-
run: npx ng build
56+
run: npm run build

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)