• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atinc / ngx-tethys / d9ae709b-3c27-4b69-b125-b8b80b54f90b

pending completion
d9ae709b-3c27-4b69-b125-b8b80b54f90b

Pull #2757

circleci

mengshuicmq
fix: fix code review
Pull Request #2757: feat(color-picker): color-picker support disabled (#INFR-8645)

98 of 6315 branches covered (1.55%)

Branch coverage included in aggregate %.

1 of 1 new or added line in 1 file covered. (100.0%)

2392 of 13661 relevant lines covered (17.51%)

83.12 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

42.42
/src/core/store/action.ts
1
import { META_KEY } from './types';
2
import { findAndCreateStoreMetadata } from './utils';
3
import { Observable, Observer, of, throwError } from 'rxjs';
4
import { map, shareReplay, catchError, exhaustMap } from 'rxjs/operators';
5
import { MiniActionState } from './action-state';
6
import { ActionContext, ActionStatus } from './actions-stream';
7

8
/**
9
 * Decorates a method with a action information.
10✔
10
 */
10✔
11
export function MiniAction() {
12
    return function (target: any, name: string, descriptor: TypedPropertyDescriptor<any>) {
13
        const meta = findAndCreateStoreMetadata(target);
10!
14
        let action: { type: string };
10✔
15
        // default use function name as action type
16
        if (!action) {
17
            action = {
18
                type: name
10✔
19
            };
10!
20
        }
×
21
        const type = action.type;
22

10✔
23
        if ((typeof ngDevMode === 'undefined' || ngDevMode) && !action.type) {
10✔
24
            throw new Error(`Action ${action.type} is missing a static "type" property`);
25
        }
26

27
        const originalFn = descriptor.value;
28
        meta.actions[type] = {
10✔
29
            fn: name,
×
30
            originalFn: originalFn,
×
31
            type
×
32
        };
×
33

×
34
        descriptor.value = function (...args: any[]) {
35
            MiniActionState.changeAction(`${target.constructor.name}-${name}`);
×
36
            let result = originalFn.call(this, ...args);
×
37
            if (result instanceof Observable) {
38
                result = result.pipe(
39
                    catchError(error => {
×
40
                        return of({ status: ActionStatus.Errored, action: action, error: error });
41
                    }),
42
                    shareReplay(),
×
43
                    exhaustMap((result: ActionContext | any) => {
44
                        if (result && result.status === ActionStatus.Errored) {
×
45
                            return throwError(result.error);
46
                        } else {
47
                            return of(result);
48
                        }
49
                    })
50
                );
51
                result.subscribe();
52
            }
53
            return result;
54
        };
55
    };
56
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc