mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-07 20:21:25 +00:00
+21
-15
@@ -22,6 +22,23 @@ describe('StyleSheet/createReactDOMStyle', () => {
|
||||
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', () => {
|
||||
test('defaults to 0 when "null"', () => {
|
||||
expect(createReactDOMStyle({ borderWidth: null })).toEqual({
|
||||
@@ -134,21 +151,10 @@ describe('StyleSheet/createReactDOMStyle', () => {
|
||||
});
|
||||
});
|
||||
|
||||
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();
|
||||
test('fontVariant', () => {
|
||||
expect(createReactDOMStyle({ fontVariant: ['common-ligatures', 'small-caps'] })).toEqual({
|
||||
fontVariant: 'common-ligatures small-caps'
|
||||
});
|
||||
});
|
||||
|
||||
describe('shadow styles', () => {
|
||||
|
||||
@@ -247,6 +247,13 @@ const createReducer = (style, styleProps) => {
|
||||
break;
|
||||
}
|
||||
|
||||
case 'fontVariant': {
|
||||
if (Array.isArray(value) && value.length > 0) {
|
||||
resolvedStyle.fontVariant = value.join(' ');
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 'shadowColor':
|
||||
case 'shadowOffset':
|
||||
case 'shadowOpacity':
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import ColorPropType from '../ColorPropType';
|
||||
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]);
|
||||
|
||||
@@ -35,6 +35,7 @@ const TextStylePropTypes = {
|
||||
fontSize: numberOrString,
|
||||
fontStyle: string,
|
||||
fontWeight: string,
|
||||
fontVariant: array,
|
||||
letterSpacing: numberOrString,
|
||||
lineHeight: numberOrString,
|
||||
textAlign: TextAlignPropType,
|
||||
|
||||
@@ -109,6 +109,7 @@ const styles = StyleSheet.create({
|
||||
// inherit parent font styles
|
||||
fontFamily: 'inherit',
|
||||
fontSize: 'inherit',
|
||||
fontVariant: ['inherit'],
|
||||
whiteSpace: 'inherit'
|
||||
},
|
||||
notSelectable: {
|
||||
|
||||
Reference in New Issue
Block a user