forked from microsoft/fluentui
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
@fluentui/react-button - Adding conformance tests to components (micr…
…osoft#13690) * adding isConformant to react-button * modifying jest setup * Change files
- Loading branch information
1 parent
d4a8768
commit 7e49098
Showing
6 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
change/@fluentui-react-button-2020-06-18-14-00-55-react-button-conformance.json
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,8 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Adding conformance test to components.", | ||
"packageName": "@fluentui/react-button", | ||
"email": "esteban.230@hotmail.com", | ||
"dependentChangeType": "none", | ||
"date": "2020-06-18T20:00:55.137Z" | ||
} |
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,11 @@ | ||
/** Jest test setup file. */ | ||
const { configure } = require('enzyme'); | ||
const Adapter = require('enzyme-adapter-react-16'); | ||
|
||
// Mock requestAnimationFrame for React 16+. | ||
global.requestAnimationFrame = callback => { | ||
setTimeout(callback, 0); | ||
}; | ||
|
||
// Configure enzyme. | ||
configure({ adapter: new Adapter() }); |
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,13 @@ | ||
const { createConfig } = require('@uifabric/build/jest/jest-resources'); | ||
const path = require('path'); | ||
|
||
const config = createConfig({ | ||
setupFiles: [path.resolve(path.join(__dirname, 'config', 'tests.js'))], | ||
|
||
moduleNameMapper: { | ||
'@fluentui/react-conformance/lib/(.*)$': '@fluentui/react-conformance/lib-commonjs/$1', | ||
'@fluentui/react-conformance$': '@fluentui/react-conformance/lib-commonjs/index', | ||
}, | ||
}); | ||
|
||
module.exports = config; |
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
12 changes: 12 additions & 0 deletions
12
packages/react-button/src/components/Button/Button.test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as path from 'path'; | ||
import { isConformant } from '@fluentui/react-conformance'; | ||
import { Button } from './Button'; | ||
|
||
describe('Button', () => { | ||
isConformant({ | ||
componentPath: path.join(__dirname, 'Button.tsx'), | ||
Component: Button, | ||
displayName: 'Button', | ||
disabledTests: ['has-docblock'], | ||
}); | ||
}); |
12 changes: 12 additions & 0 deletions
12
packages/react-button/src/components/ToggleButton/ToggleButton.test.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import * as path from 'path'; | ||
import { isConformant } from '@fluentui/react-conformance'; | ||
import { ToggleButton } from './ToggleButton'; | ||
|
||
describe('ToggleButton', () => { | ||
isConformant({ | ||
componentPath: path.join(__dirname, 'ToggleButton.tsx'), | ||
Component: ToggleButton, | ||
displayName: 'ToggleButton', | ||
disabledTests: ['has-docblock'], | ||
}); | ||
}); |