( contexts: string[] | undefined, context: string )
| 106 | } |
| 107 | |
| 108 | export function toggleContextInList( |
| 109 | contexts: string[] | undefined, |
| 110 | context: string |
| 111 | ): string[] | undefined { |
| 112 | const value = normalizeContextValue(context); |
| 113 | const current = normalizeContextList(contexts); |
| 114 | if (!value) return current.length > 0 ? current : undefined; |
| 115 | return current.includes(value) |
| 116 | ? removeContextFromList(current, value) |
| 117 | : addContextToList(current, value); |
| 118 | } |
| 119 | |
| 120 | function getSubmenu(item: MenuItem): Menu { |
| 121 | return (item as unknown as SubmenuMenuItem).setSubmenu(); |
no test coverage detected