1 | import * as ts from 'typescript';
|
2 | import { getJsxAttributesFromJsxElement, getStringLiteral } from '../JsxAttribute';
|
3 |
|
4 | const typeString: string = 'type';
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function getImplicitRoleForMenu(node: ts.Node): string {
|
10 | const typeAttribute: ts.JsxAttribute = getJsxAttributesFromJsxElement(node)[typeString];
|
11 |
|
12 | if (typeAttribute) {
|
13 | const value: string = getStringLiteral(typeAttribute) || undefined;
|
14 |
|
15 | return value && value.toUpperCase() === 'TOOLBAR' ? 'toolbar' : undefined;
|
16 | }
|
17 |
|
18 | return undefined;
|
19 | }
|
20 |
|
21 | export { getImplicitRoleForMenu as menu };
|