-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Add support for analytics tag
- Loading branch information
1 parent
081f197
commit f6af30b
Showing
5 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import * as React from 'react'; | ||
|
||
export interface ExampleProps { | ||
/** | ||
* @analytics View details in Analytics tab | ||
*/ | ||
analyticsMetadata?: string; | ||
children?: React.ReactNode; | ||
} | ||
|
||
export default function Example({ children }: ExampleProps): JSX.Element { | ||
return <div>{children}</div>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "." | ||
}, | ||
"include": ["./**/*.tsx"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
import { ComponentDefinition } from '../../src/components/interfaces'; | ||
import { buildProject } from './test-helpers'; | ||
|
||
describe('Analytics tag', () => { | ||
let component: ComponentDefinition; | ||
beforeAll(() => { | ||
const result = buildProject('analytics-tag'); | ||
expect(result).toHaveLength(1); | ||
|
||
component = result[0]; | ||
}); | ||
|
||
test('should have correct properties definitions', () => { | ||
expect(component.properties).toEqual([ | ||
{ | ||
name: 'analyticsMetadata', | ||
analyticsTag: 'View details in Analytics tab', | ||
defaultValue: undefined, | ||
deprecatedTag: undefined, | ||
description: '', | ||
i18nTag: undefined, | ||
inlineType: undefined, | ||
optional: true, | ||
type: 'string', | ||
visualRefreshTag: undefined, | ||
}, | ||
]); | ||
}); | ||
|
||
test('should have correct regions definitions', () => { | ||
expect(component.regions).toEqual([ | ||
{ | ||
name: 'children', | ||
analyticsTag: undefined, | ||
isDefault: true, | ||
deprecatedTag: undefined, | ||
description: undefined, | ||
displayName: undefined, | ||
i18nTag: undefined, | ||
visualRefreshTag: undefined, | ||
}, | ||
]); | ||
}); | ||
}); |