Add very basic jest snapshots for RadioGroup (#697)

* Add very basic jest snapshots for RadioGroup

* Change files
This commit is contained in:
Andrew Coates 2021-05-19 18:53:21 -07:00 коммит произвёл GitHub
Родитель 1f11630335
Коммит 3aa5c6b7f9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 357 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,8 @@
{
"type": "none",
"comment": "Add very basic jest snapshots for RadioGroup",
"packageName": "@fluentui-react-native/radio-group",
"email": "30809111+acoates-ms@users.noreply.github.com",
"dependentChangeType": "none",
"date": "2021-05-20T00:35:41.482Z"
}

Просмотреть файл

@ -0,0 +1,2 @@
const { configureReactNativeJest } = require('@uifabricshared/build-native');
module.exports = configureReactNativeJest('android');

Просмотреть файл

@ -32,6 +32,7 @@
"@uifabricshared/foundation-settings": ">=0.8.0 <1.0.0"
},
"devDependencies": {
"@fluentui-react-native/test-tools": ">=0.1.1 <1.0.0",
"@office-iss/react-native-win32": "^0.63.7",
"@types/react-native": "^0.63.0",
"@uifabricshared/build-native": "^0.1.1",

Просмотреть файл

@ -0,0 +1,10 @@
import * as React from 'react';
import { RadioButton } from './RadioButton';
import * as renderer from 'react-test-renderer';
describe('RadioButton component tests', () => {
it('RadioButton default', () => {
const tree = renderer.create(<RadioButton buttonKey="key1" content="Default Button" />).toJSON();
expect(tree).toMatchSnapshot();
});
});

Просмотреть файл

@ -0,0 +1,16 @@
import * as React from 'react';
import { RadioGroup, RadioButton } from '.';
import * as renderer from 'react-test-renderer';
describe('RadioButton component tests', () => {
it('RadioButton default', () => {
const tree = renderer.create(
<RadioGroup label="Uncontrolled RadioGroup" defaultSelectedKey="key2">
<RadioButton buttonKey="key1" content="RadioButton1" />
<RadioButton buttonKey="key2" content="RadioButton2" />
</RadioGroup>,
);
expect(tree).toMatchSnapshot();
});
});

Просмотреть файл

@ -0,0 +1,97 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`RadioButton component tests RadioButton default 1`] = `
<View
accessibilityActions={
Array [
Object {
"label": "Select a RadioButton",
"name": "Select",
},
]
}
accessibilityLabel="Default Button"
accessibilityRole="radio"
accessibilityState={
Object {
"disabled": false,
"selected": false,
}
}
accessible={true}
focusable={true}
onAccessibilityAction={[Function]}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onPress={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "flex-start",
"display": "flex",
"flexDirection": "row",
"marginTop": 0,
"minHeight": 20,
"position": "relative",
}
}
>
<View
style={
Object {
"backgroundColor": "transparent",
"borderColor": "#323130",
"borderRadius": 10,
"borderStyle": "solid",
"borderWidth": 1,
"height": 20,
"left": 0,
"marginBottom": 6,
"marginLeft": 6,
"marginRight": 6,
"marginTop": 4,
"top": 0,
"width": 20,
}
}
>
<View
style={
Object {
"backgroundColor": "#323130",
"borderRadius": 5,
"height": 10,
"left": 4,
"opacity": 0,
"position": "relative",
"top": 4,
"width": 10,
}
}
/>
</View>
<Text
style={
Object {
"borderColor": "transparent",
"borderStyle": "solid",
"borderWidth": 2,
"color": "#323130",
"fontFamily": "Segoe UI",
"fontSize": 16,
"fontWeight": "400",
"margin": 0,
"marginTop": 3,
}
}
>
Default Button
</Text>
</View>
`;

Просмотреть файл

@ -0,0 +1,221 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`RadioButton component tests RadioButton default 1`] = `
<View
accessibilityLabel="Uncontrolled RadioGroup"
accessibilityRole="radiogroup"
accessible={true}
rest={Object {}}
style={
Object {
"alignItems": "flex-start",
"display": "flex",
"flexDirection": "column",
}
}
>
<Text
style={
Object {
"color": "#323130",
"fontFamily": "inherit",
"fontSize": 16,
"fontWeight": "600",
"margin": 0,
}
}
>
Uncontrolled RadioGroup
</Text>
<RCTFocusZone
navigateAtEnd="NavigateWrap"
>
<View
accessibilityActions={
Array [
Object {
"label": "Select a RadioButton",
"name": "Select",
},
]
}
accessibilityLabel="RadioButton1"
accessibilityRole="radio"
accessibilityState={
Object {
"disabled": false,
"selected": false,
}
}
accessible={true}
focusable={true}
onAccessibilityAction={[Function]}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onPress={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "flex-start",
"display": "flex",
"flexDirection": "row",
"marginTop": 0,
"minHeight": 20,
"position": "relative",
}
}
>
<View
style={
Object {
"backgroundColor": "transparent",
"borderColor": "#323130",
"borderRadius": 10,
"borderStyle": "solid",
"borderWidth": 1,
"height": 20,
"left": 0,
"marginBottom": 6,
"marginLeft": 6,
"marginRight": 6,
"marginTop": 4,
"top": 0,
"width": 20,
}
}
>
<View
style={
Object {
"backgroundColor": "#323130",
"borderRadius": 5,
"height": 10,
"left": 4,
"opacity": 0,
"position": "relative",
"top": 4,
"width": 10,
}
}
/>
</View>
<Text
style={
Object {
"borderColor": "transparent",
"borderStyle": "solid",
"borderWidth": 2,
"color": "#323130",
"fontFamily": "Segoe UI",
"fontSize": 16,
"fontWeight": "400",
"margin": 0,
"marginTop": 3,
}
}
>
RadioButton1
</Text>
</View>
<View
accessibilityActions={
Array [
Object {
"label": "Select a RadioButton",
"name": "Select",
},
]
}
accessibilityLabel="RadioButton2"
accessibilityRole="radio"
accessibilityState={
Object {
"disabled": false,
"selected": true,
}
}
accessible={true}
focusable={true}
onAccessibilityAction={[Function]}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onPress={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"alignItems": "flex-start",
"display": "flex",
"flexDirection": "row",
"marginTop": 0,
"minHeight": 20,
"position": "relative",
}
}
>
<View
style={
Object {
"backgroundColor": "transparent",
"borderColor": "#323130",
"borderRadius": 10,
"borderStyle": "solid",
"borderWidth": 1,
"height": 20,
"left": 0,
"marginBottom": 6,
"marginLeft": 6,
"marginRight": 6,
"marginTop": 4,
"top": 0,
"width": 20,
}
}
>
<View
style={
Object {
"backgroundColor": "#323130",
"borderRadius": 5,
"height": 10,
"left": 4,
"opacity": 1,
"position": "relative",
"top": 4,
"width": 10,
}
}
/>
</View>
<Text
style={
Object {
"borderColor": "transparent",
"borderStyle": "solid",
"borderWidth": 2,
"color": "#323130",
"fontFamily": "Segoe UI",
"fontSize": 16,
"fontWeight": "400",
"margin": 0,
"marginTop": 3,
}
}
>
RadioButton2
</Text>
</View>
</RCTFocusZone>
</View>
`;

Просмотреть файл

@ -1,7 +1,8 @@
{
"extends": "@uifabricshared/build-native/tsconfig.json",
"compilerOptions": {
"outDir": "lib"
"outDir": "lib",
"types": ["node", "jest"]
},
"include": ["src"]
}