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

ckeditor / ckeditor5-inspector / 4e8ab897-03a3-4290-a64f-2b7935e4be58

03 Oct 2024 05:19AM UTC coverage: 95.42%. Remained the same
4e8ab897-03a3-4290-a64f-2b7935e4be58

Pull #189

circleci

psmyrek
Bumped `ckeditor5-dev-*` to latest stable version.
Pull Request #189: Aligned to `ckeditor5-dev` ESM changes

522 of 560 branches covered (93.21%)

Branch coverage included in aggregate %.

1124 of 1165 relevant lines covered (96.48%)

113.15 hits per line

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

85.71
/src/commands/data/reducer.js
1
/**
2
 * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
 * For licensing, see LICENSE.md.
4
 */
5

6
import {
7
        SET_COMMANDS_CURRENT_COMMAND_NAME,
8
        UPDATE_COMMANDS_STATE
9
} from './actions';
10

11
import {
12
        SET_EDITORS,
13
        SET_CURRENT_EDITOR_NAME,
14
        SET_ACTIVE_INSPECTOR_TAB
15
} from '../../data/actions';
16

17
import {
18
        getCommandsTreeDefinition,
19
        getEditorCommandDefinition
20
} from './utils';
21

22
export default function commandsReducer( globalState, commandsState, action ) {
23
        // Performance optimization: don't create the commands state unless necessary.
24
        if ( globalState.ui.activeTab !== 'Commands' ) {
205✔
25
                return commandsState;
178✔
26
        }
27

28
        if ( !commandsState ) {
27✔
29
                return getBlankCommandsState( globalState, commandsState );
15✔
30
        }
31

32
        switch ( action.type ) {
12!
33
                case SET_COMMANDS_CURRENT_COMMAND_NAME:
34
                        return {
2✔
35
                                ...commandsState,
36

37
                                currentCommandDefinition: getEditorCommandDefinition( globalState, action.currentCommandName ),
38
                                currentCommandName: action.currentCommandName
39
                        };
40

41
                // * SET_ACTIVE_INSPECTOR_TAB – Because of the performance optimization at the beginning, update the state
42
                // if we're back in the commands tab.
43
                // * UPDATE_MODEL_STATE – An action called by the editorEventObserver for the model document change.
44
                case SET_ACTIVE_INSPECTOR_TAB:
45
                case UPDATE_COMMANDS_STATE:
46
                        return {
4✔
47
                                ...commandsState,
48

49
                                currentCommandDefinition: getEditorCommandDefinition( globalState, commandsState.currentCommandName ),
50
                                treeDefinition: getCommandsTreeDefinition( globalState, commandsState )
51
                        };
52

53
                // Actions related to the external state.
54
                case SET_EDITORS:
55
                case SET_CURRENT_EDITOR_NAME:
56
                        return getBlankCommandsState( globalState, commandsState );
6✔
57

58
                default:
59
                        return commandsState;
×
60
        }
61
}
62

63
function getBlankCommandsState( globalState, commandsState = {} ) {
×
64
        return {
21✔
65
                ...commandsState,
66

67
                currentCommandName: null,
68
                currentCommandDefinition: null,
69
                treeDefinition: getCommandsTreeDefinition( globalState, commandsState )
70
        };
71
}
72

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