mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-08 12:32:58 +00:00
+21
-15
@@ -22,6 +22,23 @@ describe('StyleSheet/createReactDOMStyle', () => {
|
|||||||
expect(firstStyle).toEqual(secondStyle);
|
expect(firstStyle).toEqual(secondStyle);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('shortform -> longform', () => {
|
||||||
|
const style = {
|
||||||
|
borderStyle: 'solid',
|
||||||
|
boxSizing: 'border-box',
|
||||||
|
borderBottomColor: 'white',
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderWidth: 0,
|
||||||
|
marginTop: 50,
|
||||||
|
marginVertical: 25,
|
||||||
|
margin: 10,
|
||||||
|
overflow: 'hidden',
|
||||||
|
overscrollBehavior: 'contain'
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(createReactDOMStyle(style)).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
describe('borderWidth styles', () => {
|
describe('borderWidth styles', () => {
|
||||||
test('defaults to 0 when "null"', () => {
|
test('defaults to 0 when "null"', () => {
|
||||||
expect(createReactDOMStyle({ borderWidth: null })).toEqual({
|
expect(createReactDOMStyle({ borderWidth: null })).toEqual({
|
||||||
@@ -134,21 +151,10 @@ describe('StyleSheet/createReactDOMStyle', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('shortform -> longform', () => {
|
test('fontVariant', () => {
|
||||||
const style = {
|
expect(createReactDOMStyle({ fontVariant: ['common-ligatures', 'small-caps'] })).toEqual({
|
||||||
borderStyle: 'solid',
|
fontVariant: 'common-ligatures small-caps'
|
||||||
boxSizing: 'border-box',
|
});
|
||||||
borderBottomColor: 'white',
|
|
||||||
borderBottomWidth: 1,
|
|
||||||
borderWidth: 0,
|
|
||||||
marginTop: 50,
|
|
||||||
marginVertical: 25,
|
|
||||||
margin: 10,
|
|
||||||
overflow: 'hidden',
|
|
||||||
overscrollBehavior: 'contain'
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(createReactDOMStyle(style)).toMatchSnapshot();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('shadow styles', () => {
|
describe('shadow styles', () => {
|
||||||
|
|||||||
@@ -247,6 +247,13 @@ const createReducer = (style, styleProps) => {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 'fontVariant': {
|
||||||
|
if (Array.isArray(value) && value.length > 0) {
|
||||||
|
resolvedStyle.fontVariant = value.join(' ');
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case 'shadowColor':
|
case 'shadowColor':
|
||||||
case 'shadowOffset':
|
case 'shadowOffset':
|
||||||
case 'shadowOpacity':
|
case 'shadowOpacity':
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import ColorPropType from '../ColorPropType';
|
import ColorPropType from '../ColorPropType';
|
||||||
import ViewStylePropTypes from '../View/ViewStylePropTypes';
|
import ViewStylePropTypes from '../View/ViewStylePropTypes';
|
||||||
import { number, oneOf, oneOfType, shape, string } from 'prop-types';
|
import { array, number, oneOf, oneOfType, shape, string } from 'prop-types';
|
||||||
|
|
||||||
const numberOrString = oneOfType([number, string]);
|
const numberOrString = oneOfType([number, string]);
|
||||||
|
|
||||||
@@ -35,6 +35,7 @@ const TextStylePropTypes = {
|
|||||||
fontSize: numberOrString,
|
fontSize: numberOrString,
|
||||||
fontStyle: string,
|
fontStyle: string,
|
||||||
fontWeight: string,
|
fontWeight: string,
|
||||||
|
fontVariant: array,
|
||||||
letterSpacing: numberOrString,
|
letterSpacing: numberOrString,
|
||||||
lineHeight: numberOrString,
|
lineHeight: numberOrString,
|
||||||
textAlign: TextAlignPropType,
|
textAlign: TextAlignPropType,
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ const styles = StyleSheet.create({
|
|||||||
// inherit parent font styles
|
// inherit parent font styles
|
||||||
fontFamily: 'inherit',
|
fontFamily: 'inherit',
|
||||||
fontSize: 'inherit',
|
fontSize: 'inherit',
|
||||||
|
fontVariant: ['inherit'],
|
||||||
whiteSpace: 'inherit'
|
whiteSpace: 'inherit'
|
||||||
},
|
},
|
||||||
notSelectable: {
|
notSelectable: {
|
||||||
|
|||||||
@@ -196,6 +196,10 @@ const stylePropTypes = [
|
|||||||
name: 'fontStyle',
|
name: 'fontStyle',
|
||||||
typeInfo: 'string'
|
typeInfo: 'string'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'fontVariant',
|
||||||
|
typeInfo: 'Array<string>'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'fontWeight',
|
name: 'fontWeight',
|
||||||
typeInfo: 'string'
|
typeInfo: 'string'
|
||||||
|
|||||||
Reference in New Issue
Block a user