Skip to content

Commit 75ba00d

Browse files
committed
feat: enhance testing framework and add comprehensive unit tests with coverage reports
1 parent aec1545 commit 75ba00d

8 files changed

Lines changed: 706 additions & 21 deletions

File tree

.github/workflows/main.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- '*'
77
jobs:
8-
build-angular-lib:
8+
build-and-test:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
@@ -14,5 +14,12 @@ jobs:
1414
node-version: '20'
1515
- run: npm ci
1616
- run: npm run build
17+
- run: npm run test:ci
18+
- name: Upload coverage reports
19+
uses: actions/upload-artifact@v4
20+
with:
21+
name: coverage-report
22+
path: coverage/row-actions/
23+
retention-days: 30
1724

1825

RELEASE_NOTES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@
66
- **Improved animation** - Replaced `scaleX` animation with `clip-path` for smoother reveal effect without content distortion
77
- **Code quality** - Migrated to Angular signals (`input()`), added `DestroyRef` for proper cleanup, improved typing
88

9+
### Testing
10+
- **Unit tests** - Added comprehensive test suite with 23 tests covering:
11+
- Row-actions display on hover
12+
- Position detection (left/right)
13+
- Vertical and horizontal alignment
14+
- Mouse interactions
15+
- Multiple rows behavior
16+
- Content projection
17+
- **CI/CD** - Tests integrated in GitHub Actions workflow with coverage reports
18+
- **Coverage** - 94%+ statement coverage
19+
920
---
1021

1122
## 2.0.3

angular.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,12 @@
8080
"builder": "@angular-devkit/build-angular:karma",
8181
"options": {
8282
"tsConfig": "tsconfig.spec.json",
83+
"karmaConfig": "karma.conf.js",
8384
"polyfills": [
8485
"zone.js",
8586
"zone.js/testing"
86-
]
87+
],
88+
"codeCoverage": true
8789
}
8890
}
8991
}

karma.conf.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular-devkit/build-angular'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage'),
13+
require('@angular-devkit/build-angular/plugins/karma')
14+
],
15+
client: {
16+
jasmine: {
17+
// you can add configuration options for Jasmine here
18+
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
19+
// for example, you can disable the random execution with `random: false`
20+
// or set a specific seed with `seed: 4321`
21+
},
22+
clearContext: false // leave Jasmine Spec Runner output visible in browser
23+
},
24+
jasmineHtmlReporter: {
25+
suppressAll: true // removes the duplicated traces
26+
},
27+
coverageReporter: {
28+
dir: require('path').join(__dirname, './coverage/row-actions'),
29+
subdir: '.',
30+
reporters: [
31+
{ type: 'html' },
32+
{ type: 'text-summary' },
33+
{ type: 'lcovonly' }
34+
]
35+
},
36+
reporters: ['progress', 'kjhtml'],
37+
browsers: ['Chrome'],
38+
restartOnFileChange: true
39+
});
40+
};

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"cp:archway-ui": "cp -r dist/* ../../softwarity/archway/archway-ui/node_modules/@hhangular/row-actions/",
2727
"watch": "ng build row-actions --watch --configuration development",
2828
"test": "cross-env CHROME_BIN='/usr/bin/google-chrome' ng test",
29-
"test:ci": "ng test"
29+
"test:ci": "ng test --no-watch --browsers=ChromeHeadless"
3030
},
3131
"dependencies": {
3232
"tslib": "^2.6.2"

projects/demo/tsconfig.app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"baseUrl": "./",
66
"types": [],
77
"paths": {
8-
"@hhangular/row-actions": ["../../dist"]
8+
"@hhangular/row-actions": ["../../dist/lib"]
99
}
1010
},
1111
"files": [

0 commit comments

Comments
 (0)