You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					31 lines
				
				511 B
			
		
		
			
		
	
	
					31 lines
				
				511 B
			| 
								 
											3 years ago
										 
									 | 
							
								import { system, compose } from '../src'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const color = system({
							 | 
						||
| 
								 | 
							
								  color: true,
							 | 
						||
| 
								 | 
							
								  bg: {
							 | 
						||
| 
								 | 
							
								    property: 'backgroundColor',
							 | 
						||
| 
								 | 
							
								  },
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const fontSize = system({
							 | 
						||
| 
								 | 
							
								  fontSize: true,
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								test('compose combines style parsers', () => {
							 | 
						||
| 
								 | 
							
								  const parser = compose(
							 | 
						||
| 
								 | 
							
								    color,
							 | 
						||
| 
								 | 
							
								    fontSize
							 | 
						||
| 
								 | 
							
								  )
							 | 
						||
| 
								 | 
							
								  const styles = parser({
							 | 
						||
| 
								 | 
							
								    color: 'tomato',
							 | 
						||
| 
								 | 
							
								    bg: 'black',
							 | 
						||
| 
								 | 
							
								    fontSize: 32,
							 | 
						||
| 
								 | 
							
								  })
							 | 
						||
| 
								 | 
							
								  expect(typeof parser).toBe('function')
							 | 
						||
| 
								 | 
							
								  expect(styles).toEqual({
							 | 
						||
| 
								 | 
							
								    fontSize: 32,
							 | 
						||
| 
								 | 
							
								    color: 'tomato',
							 | 
						||
| 
								 | 
							
								    backgroundColor: 'black',
							 | 
						||
| 
								 | 
							
								  })
							 | 
						||
| 
								 | 
							
								})
							 |